|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.threerings.jpkg.PackageTarFile
public class PackageTarFile
A wrapper around TarOutputStream to handle adding files from a destroot into a tar file. Every regular file will have its md5 checksum recorded and the total amount of file data in kilobytes will be stored.
Constructor Summary | |
---|---|
PackageTarFile(File safeTemp)
Convenience constructor to create PackageTarFile with an empty PermissionsMap . |
|
PackageTarFile(File safeTemp,
PermissionsMap permissions)
Initialize a PackageTar file. |
Method Summary | |
---|---|
void |
addDirectory(File directory)
Add the contents of the supplied directory to the tar file. |
void |
addFile(File file)
Add directories and files to the tar archive without stripping a leading path. |
void |
addFile(File file,
String stripPath)
Add directories and files to the tar archive. |
void |
close()
Closes the tar file. |
boolean |
delete()
Deletes the tar file. |
int |
getGroupId()
Returns the group id which will own this entry in the archive. |
InputStream |
getInputStream()
Returns an InputStream from the data contained in this entry. |
Map<String,String> |
getMd5s()
Return the map of tar entry paths to md5 checksums for regular files added to this tar file. |
int |
getMode()
Returns the file permissions mode (e.g. |
String |
getPath()
Returns the path name used to identify this entry in the archive. |
long |
getSize()
Returns the size of the data contained in this entry in bytes. |
long |
getTotalDataSize()
Return the total amount of file data added to this tar file, in kilobytes. |
int |
getUserId()
Returns the user id which will own this entry in the archive. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public PackageTarFile(File safeTemp) throws IOException
PackageTarFile
with an empty PermissionsMap
.
IOException
PackageTarFile(File, PermissionsMap)
public PackageTarFile(File safeTemp, PermissionsMap permissions) throws IOException
safeTemp
- A location with enough free space to hold the tar data.permissions
- A PermissionsMap
will be used to manipulate entries before being
added to the tar file.
IOException
- If the tar file cannot be initialized due to i/o errors.Method Detail |
---|
public void addDirectory(File directory) throws IOException
IOException
public void addFile(File file) throws DuplicatePermissionsException, IOException
DuplicatePermissionsException
IOException
addFile(File, String)
public void addFile(File file, String stripPath) throws DuplicatePermissionsException, IOException
file
- The File
to add to the tar archive.stripPath
- The path to stripped from the start of any entry path before adding it to
the tar file.
InvalidPathException
- If the supplied stripPath path cannot be normalized.
DuplicatePermissionsException
- If more than one permission in the defined
PermissionsMap
maps to the file being added.
IOException
- If any i/o exceptions occur when appending the file data.public void close() throws IOException
IOException
public boolean delete()
public Map<String,String> getMd5s()
public long getTotalDataSize()
public InputStream getInputStream() throws IOException
ArchiveEntry
InputStream
from the data contained in this entry.
getInputStream
in interface ArchiveEntry
IOException
public long getSize()
ArchiveEntry
Archive
can only
store data whose size can be expressed in a 32 bit integer however the interface allows
size to be expressed as a long to support for example File
objects. The
Archive
class will guarantee that the size returned by this method can be converted
safely into a 32 bit integer.
getSize
in interface ArchiveEntry
public String getPath()
ArchiveEntry
getPath
in interface ArchiveEntry
public int getUserId()
ArchiveEntry
getUserId
in interface ArchiveEntry
public int getGroupId()
ArchiveEntry
getGroupId
in interface ArchiveEntry
public int getMode()
ArchiveEntry
getMode
in interface ArchiveEntry
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |