public class Contents extends Object
| Modifier and Type | Field and Description |
|---|---|
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,
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.
|
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.
|
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.
|
String[] |
getMD5s()
Caclulates an MD5 hash for each file in the archive.
|
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 static 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.public void addLink(String path, String target, int permissions)
path - the destination path for the installed file.permissions - the permissions flags.public 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.FileNotFoundExceptionpublic 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.FileNotFoundExceptionpublic 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.FileNotFoundExceptionpublic 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.FileNotFoundExceptionpublic 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 fileFileNotFoundExceptionpublic 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 fileFileNotFoundExceptionpublic 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.FileNotFoundExceptionpublic 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 fileFileNotFoundExceptionprotected void addParents(File file, int permissions, String uname, String gname)
public static void addBuiltinDirectory(String directory)
directory - public 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.public 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[] getMD5s() throws NoSuchAlgorithmException, IOException
NoSuchAlgorithmExceptionIOExceptionpublic 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 © 2014. All Rights Reserved.