public class Contents extends Object
| Modifier and Type | Field and Description |
|---|---|
protected Set<String> |
builtins |
protected Set<String> |
files |
protected Set<CpioHeader> |
headers |
protected Map<CpioHeader,Object> |
sources |
| Constructor and Description |
|---|
Contents() |
| Modifier and Type | Method and Description |
|---|---|
static void |
addBuiltinDirectory(String directory)
Add additional directory that is assumed to already exist on system where the RPM will be installed
(e.g.
|
void |
addDirectory(String path)
Adds a directory entry to the archive with the default permissions of 644.
|
void |
addDirectory(String path,
Directive directive)
Adds a directory entry to the archive with the default permissions of 644.
|
void |
addDirectory(String path,
int permissions)
Adds a directory entry to the archive with the specified permissions.
|
void |
addDirectory(String path,
int permissions,
Directive directive,
String uname,
String gname)
Adds a directory entry to the archive with the specified permissions.
|
void |
addDirectory(String path,
int permissions,
Directive directive,
String uname,
String gname,
boolean addParents)
Adds a directory entry to the archive with the specified permissions.
|
void |
addFile(String path,
File source)
Adds a file entry to the archive with the default permissions of 644.
|
void |
addFile(String path,
File source,
int permissions)
Adds a file entry to the archive with the specified permissions.
|
void |
addFile(String path,
File source,
int permissions,
Directive directive)
Adds a file entry to the archive with the specified permissions.
|
void |
addFile(String path,
File source,
int permissions,
Directive directive,
String uname,
String gname)
Adds a file entry to the archive with the specified permissions.
|
void |
addFile(String path,
File source,
int permissions,
Directive directive,
String uname,
String gname,
int dirmode)
Adds a file entry to the archive with the specified permissions.
|
void |
addFile(String path,
File source,
int permissions,
Directive directive,
String uname,
String gname,
int dirmode,
boolean addParents)
Adds a file entry to the archive with the specified permissions.
|
void |
addFile(String path,
File source,
int permissions,
Directive directive,
String uname,
String gname,
int dirmode,
boolean addParents,
int verifyFlags)
Adds a file entry to the archive with the specified permissions.
|
void |
addFile(String path,
File source,
int permissions,
int dirmode)
Adds a file entry to the archive with the specified permissions.
|
void |
addLink(String path,
String target)
Adds a directory entry to the archive with the default permissions of 644.
|
void |
addLink(String path,
String target,
int permissions)
Adds a directory entry to the archive with the specified permissions.
|
void |
addLink(String path,
String target,
int permissions,
String uname,
String gname)
Adds a directory entry to the archive with the specified permissions.
|
void |
addLocalBuiltinDirectory(String directory)
Add additional directory that is assumed to already exist on system where the RPM will be installed
(e.g.
|
protected void |
addParents(File file,
int permissions,
String uname,
String gname)
Adds entries for parent directories of this file, so that they may be cleaned up when
removing the package.
|
void |
addURL(String path,
URL source,
int permissions,
Directive directive,
String uname,
String gname,
int dirmode)
Adds a URL entry to the archive with the specified permissions.
|
String[] |
getBaseNames()
Gets the basenames header values.
|
int[] |
getClasses()
Gets the classes header values.
|
int[] |
getColors()
Gets the colors header values.
|
String[] |
getContexts()
Gets the contexts header values.
|
int[] |
getDependsN()
Gets the dependsn header values.
|
int[] |
getDependsX()
Gets the dependsx header values.
|
int[] |
getDevices()
Gets the devices header values.
|
int[] |
getDirIndexes()
Gets the dirindexes headers values.
|
String[] |
getDirNames()
Gets the dirnames headers values.
|
String[] |
getFileChecksums()
Caclulates an MD5 hash for each file in the archive.
|
int[] |
getFlags()
Gets the flags header values.
|
String[] |
getGroups()
Gets the groups header values.
|
int[] |
getInodes()
Gets the inodes header values.
|
String[] |
getLangs()
Gets the langs header values.
|
String[] |
getLinkTos()
Gets the linktos header values.
|
short[] |
getModes()
Gets the modes header values.
|
int[] |
getMtimes()
Gets the mtimes header values.
|
short[] |
getRdevs()
Gets the rdevs header values.
|
int[] |
getSizes()
Gets the sizes header values.
|
Object |
getSource(CpioHeader header)
Retrieves the content for this archive entry, which may be a
File if the entry is a regular file or
a CharSequence containing the name of the target path if the entry is a link. |
int |
getTotalSize()
Accumulated size of all files included in the archive.
|
String[] |
getUsers()
Gets the users header values.
|
int[] |
getVerifyFlags()
Gets the verifyflags header values.
|
Iterable<CpioHeader> |
headers()
Retrieve the archive headers.
|
protected void |
listParents(List<String> parents,
File file)
Generates a list of parent paths given a starting path.
|
int |
size()
Retrieve the size of this archive in number of files.
|
protected final Set<CpioHeader> headers
protected final Map<CpioHeader,Object> sources
public void addLink(String path, String target)
path - the destination path for the installed file.target - the target stringpublic void addLink(String path, String target, int permissions)
path - the destination path for the installed file.target - the target stringpermissions - the permissions flags.public void addLink(String path, String target, int permissions, String uname, String gname)
path - the destination path for the installed file.target - the target stringpermissions - the permissions flags.uname - user owner for the given linkgname - group owner for the given linkpublic void addDirectory(String path)
path - the destination path for the installed file.public void addDirectory(String path, Directive directive)
path - the destination path for the installed file.directive - directive indicating special handling for this directory.public void addDirectory(String path, int permissions)
path - the destination path for the installed file.permissions - the permissions flags.public void addDirectory(String path, int permissions, Directive directive, String uname, String gname)
path - the destination path for the installed file.permissions - the permissions flags.directive - directive indicating special handling for this directory.uname - user owner for the given filegname - group owner for the given filepublic void addDirectory(String path, int permissions, Directive directive, String uname, String gname, boolean addParents)
path - the destination path for the installed file.permissions - the permissions flags.directive - directive indicating special handling for this directory.uname - user owner for the given filegname - group owner for the given fileaddParents - whether to add parent directories to the rpmpublic void addFile(String path, File source) throws FileNotFoundException
path - the destination path for the installed file.source - the local file to be included in the package.FileNotFoundException - file wasn't foundpublic void addFile(String path, File source, int permissions) throws FileNotFoundException
path - the destination path for the installed file.source - the local file to be included in the package.permissions - the permissions flags.FileNotFoundException - file wasn't foundpublic void addFile(String path, File source, int permissions, int dirmode) throws FileNotFoundException
path - the destination path for the installed file.source - the local file to be included in the package.permissions - the permissions flags.dirmode - permission flags for parent directories, use -1 to leave as default.FileNotFoundException - file wasn't foundpublic void addFile(String path, File source, int permissions, Directive directive) throws FileNotFoundException
path - the destination path for the installed file.source - the local file to be included in the package.permissions - the permissions flags.directive - directive indicating special handling for this file.FileNotFoundException - file wasn't foundpublic void addFile(String path, File source, int permissions, Directive directive, String uname, String gname) throws FileNotFoundException
path - the destination path for the installed file.source - the local file to be included in the package.permissions - the permissions flags.directive - directive indicating special handling for this file.uname - user owner for the given filegname - group owner for the given fileFileNotFoundException - file wasn't foundpublic void addFile(String path, File source, int permissions, Directive directive, String uname, String gname, int dirmode) throws FileNotFoundException
path - the destination path for the installed file.source - the local file to be included in the package.permissions - the permissions flags.directive - directive indicating special handling for this file.uname - user owner for the given filegname - group owner for the given filedirmode - permission flags for parent directories, use -1 to leave as default.FileNotFoundException - file wasn't foundpublic void addFile(String path, File source, int permissions, Directive directive, String uname, String gname, int dirmode, boolean addParents) throws FileNotFoundException
path - the destination path for the installed file.source - the local file to be included in the package.permissions - the permissions flags, use -1 to leave as default.directive - directive indicating special handling for this file, use null to ignore.uname - user owner for the given file, use null for default user.gname - group owner for the given file, use null for default group.dirmode - permission flags for parent directories, use -1 to leave as default.addParents - whether to create parent directories for the file, defaults to true for other methods.FileNotFoundException - file wasn't foundpublic void addFile(String path, File source, int permissions, Directive directive, String uname, String gname, int dirmode, boolean addParents, int verifyFlags) throws FileNotFoundException
path - the destination path for the installed file.source - the local file to be included in the package.permissions - the permissions flags, use -1 to leave as default.directive - directive indicating special handling for this file, use null to ignore.uname - user owner for the given file, use null for default user.gname - group owner for the given file, use null for default group.dirmode - permission flags for parent directories, use -1 to leave as default.addParents - whether to create parent directories for the file, defaults to true for other methods.verifyFlags - verify flagsFileNotFoundException - file wasn't foundpublic void addURL(String path, URL source, int permissions, Directive directive, String uname, String gname, int dirmode) throws FileNotFoundException
path - the destination path for the installed file.source - the URL with the data to be addedpermissions - the permissions flags.directive - directive indicating special handling for this file.uname - user owner for the given filegname - group owner for the given filedirmode - permission flags for parent directories, use -1 to leave as default.FileNotFoundException - file wasn't foundprotected void addParents(File file, int permissions, String uname, String gname)
file - the file to add parent directories ofpermissions - the permissions flagsuname - user owner for the given filegname - group owner for the given filepublic static void addBuiltinDirectory(String directory)
directory - the directory to addpublic void addLocalBuiltinDirectory(String directory)
directory - the directory to addpublic int size()
public Iterable<CpioHeader> headers()
Iterable will iterate in the correct order for
the final archive.public Object getSource(CpioHeader header)
File if the entry is a regular file or
a CharSequence containing the name of the target path if the entry is a link. This is the value to
be written to the archive as the body of the entry.header - the header to get the content frompublic int getTotalSize()
public String[] getDirNames()
public int[] getDirIndexes()
public String[] getBaseNames()
public int[] getSizes()
public short[] getModes()
public short[] getRdevs()
public int[] getMtimes()
public String[] getFileChecksums() throws NoSuchAlgorithmException, IOException
NoSuchAlgorithmException - if the algorithm isn't supportedIOException - there was an IO errorpublic String[] getLinkTos()
public int[] getFlags()
public String[] getUsers()
public String[] getGroups()
public int[] getColors()
public int[] getVerifyFlags()
public int[] getClasses()
public int[] getDevices()
public int[] getInodes()
public String[] getLangs()
public int[] getDependsX()
public int[] getDependsN()
public String[] getContexts()
Copyright © 2021. All Rights Reserved.