public interface Archiver
Some archivers might use an additional Compressor
to compress and decompress their respective archive files.
Modifier and Type | Method and Description |
---|---|
java.io.File |
create(java.lang.String archive,
java.io.File destination,
java.io.File... sources)
Creates an archive from the given source files or directories, and saves it into the given destination.
|
void |
extract(java.io.File archive,
java.io.File destination)
Extracts the given archive file into the given destination directory.
|
java.lang.String |
getFilenameExtension()
Returns the filename extension that indicates the file format this archiver handles.
|
ArchiveStream |
stream(java.io.File archive)
Reads the given archive file as an
ArchiveStream which is used to access individual ArchiveEntry
objects within the archive without extracting the archive onto the file system. |
java.io.File create(java.lang.String archive, java.io.File destination, java.io.File... sources) throws java.io.IOException
If the archive parameter has no file extension (e.g. "archive" instead of "archive.zip"), the concrete archiver implementation should append it according to its file format (.zip, .tar, .tar.gz, ...).
archive
- the name of the archive to createdestination
- the destination directory where to place the created archivesources
- the input files or directories to archivejava.io.IOException
- propagated I/O errors by java.io
void extract(java.io.File archive, java.io.File destination) throws java.io.IOException
The destination is expected to be a writable directory.
archive
- the archive file to extractdestination
- the directory to which to extract the filesjava.io.IOException
- propagated I/O errors by java.io
ArchiveStream stream(java.io.File archive) throws java.io.IOException
ArchiveStream
which is used to access individual ArchiveEntry
objects within the archive without extracting the archive onto the file system.archive
- the archive file to streamjava.io.IOException
- propagated I/O errors by java.io
java.lang.String getFilenameExtension()