Package org.rauschig.jarchivelib
Interface ArchiveEntry
-
public interface ArchiveEntryThe entry of an archive. The life of anArchiveEntryis dependent on the status of theArchiveStreamit came from. Once retrieved viaArchiveStream.getNextEntry(), the entry can be used as long as theArchiveStreamremains on this entry, i.e.getNextEntry()was not called, and the stream was not since closed.
-
-
Field Summary
Fields Modifier and Type Field Description static longUNKNOWN_SIZESpecial value indicating that the size is unknown
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.io.Fileextract(java.io.File destination)Extracts the entry to the given destination directory.java.util.DategetLastModifiedDate()Returns the last modified date of the entry.java.lang.StringgetName()The name of the entry in the archive.longgetSize()The (uncompressed) size of the entry.booleanisDirectory()Checks whether the given entry is a directory.
-
-
-
Field Detail
-
UNKNOWN_SIZE
static final long UNKNOWN_SIZE
Special value indicating that the size is unknown- See Also:
- Constant Field Values
-
-
Method Detail
-
getName
java.lang.String getName()
The name of the entry in the archive. May refer to a file or directory or other item.- Returns:
- the name of the item
-
getSize
long getSize()
The (uncompressed) size of the entry. May be -1 (UNKNOWN_SIZE) if the size is unknown- Returns:
- the size of the entry once uncompressed, or -1 if unknown.
-
getLastModifiedDate
java.util.Date getLastModifiedDate()
Returns the last modified date of the entry.- Returns:
- the date the entry was last modified.
-
isDirectory
boolean isDirectory()
Checks whether the given entry is a directory.- Returns:
- true if the entry refers to a directory
-
extract
java.io.File extract(java.io.File destination) throws java.io.IOException, java.lang.IllegalStateException, java.lang.IllegalArgumentExceptionExtracts the entry to the given destination directory. The destination is expected to be a writable directory.- Parameters:
destination- the directory to extract the value to- Returns:
- the extracted File
- Throws:
java.io.IOException- propagated I/O errors byjava.iojava.lang.IllegalStateException- if the entry is out of sync with the streamjava.lang.IllegalArgumentException- if the destination is not a directory, or a directory can not be created at the given location
-
-