Package org.rauschig.jarchivelib
Interface Compressor
-
public interface CompressorA compressor facades a specific compression library, allowing for simple compression and decompression of files.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidcompress(java.io.File source, java.io.File destination)Compresses the given input file to the given destination directory or file.voiddecompress(java.io.File source, java.io.File destination)Decompresses the given source file to the given destination directory or file.java.io.InputStreamdecompressingStream(java.io.InputStream compressedStream)Accept a stream and wrap it in a decompressing stream suitable for the current compressor.java.lang.StringgetFilenameExtension()Returns the filename extension that indicates the file format this compressor handles.
-
-
-
Method Detail
-
compress
void compress(java.io.File source, java.io.File destination) throws java.lang.IllegalArgumentException, java.io.IOExceptionCompresses the given input file to the given destination directory or file.
Requires the source the be an existing and readable File, and the destination to be either a file or a directory. If you pass a directory, the name of the source file is used, with the appended filename extension suffix of the compression type.- Parameters:
source- the source file to compressdestination- the destination file- Throws:
java.lang.IllegalArgumentException- if the source is not readable or the destination is not writablejava.io.IOException- when an I/O error occurs
-
decompress
void decompress(java.io.File source, java.io.File destination) throws java.lang.IllegalArgumentException, java.io.IOExceptionDecompresses the given source file to the given destination directory or file.
Requires the source the be an existing and readable File, and the destination to be either a file or a directory. If you pass a directory, the name of the source file is used, with the removed filename extension suffix of the compression type.- Parameters:
source- the compressed source file to decompressdestination- the destination file- Throws:
java.lang.IllegalArgumentException- if the source is not readable or the destination is not writablejava.io.IOException- when an I/O error occurs
-
decompressingStream
java.io.InputStream decompressingStream(java.io.InputStream compressedStream) throws java.io.IOExceptionAccept a stream and wrap it in a decompressing stream suitable for the current compressor.- Parameters:
compressedStream- the stream of compressed data.- Throws:
java.io.IOException- an I/O error.
-
getFilenameExtension
java.lang.String getFilenameExtension()
Returns the filename extension that indicates the file format this compressor handles. E.g .gz". or ".bz2".- Returns:
- a filename extension with a preceding dot
-
-