org.apache.commons.compress
Interface Compressor

All Known Implementing Classes:
AbstractCompressor, BZip2Compressor

public interface Compressor

The Compressor Interface defines all operations for the compress/decompress actions.


Method Summary
 InputStream compress(File input)
          Compresses this file and returns an InputStream to the compressed File
 InputStream compress(InputStream input)
          Compresses this InputStream and returns an InputStream to the compressed file
 void compressTo(File input, File output)
          Creates the file "output" with the compressed content of file "input"
 void compressTo(InputStream input, OutputStream output)
          Compresses the input stream and writes the compressed bytes to the output stream.
 void compressToHere(File input)
          Compresses the file input and creates a file in the same directory with the default file extension in its name.
 InputStream decompress(File input)
          Decompresses a file and returns an InputStream
 InputStream decompress(InputStream input)
          Decompresses a file and returns an InputStream
 void decompressTo(File input, File output)
          Decompresses this file and writes the decompressed byte to the output file
 void decompressTo(InputStream input, OutputStream output)
          Decompresses this file and writes the decompressed file to the output-stream
 

Method Detail

compress

InputStream compress(File input)
                     throws CompressException
Compresses this file and returns an InputStream to the compressed File

Parameters:
input - File to compress
Returns:
InputStream of the compressed file
Throws:
CompressException - if the Compressor reports an error

compress

InputStream compress(InputStream input)
                     throws CompressException
Compresses this InputStream and returns an InputStream to the compressed file

Parameters:
input - Stream to compress
Returns:
Stream to the compressed file
Throws:
CompressException - if the Compressor reports an error

compressToHere

void compressToHere(File input)
                    throws CompressException
Compresses the file input and creates a file in the same directory with the default file extension in its name.

Parameters:
input - the file to compress
Throws:
CompressException - if the Compressor reports an error

compressTo

void compressTo(File input,
                File output)
                throws CompressException
Creates the file "output" with the compressed content of file "input"

Parameters:
input - the file to compress
output - the file to create
Throws:
CompressException - if the Compressor reports an error

compressTo

void compressTo(InputStream input,
                OutputStream output)
                throws CompressException
Compresses the input stream and writes the compressed bytes to the output stream. This method must be implemented by all new compressortypes.

Parameters:
input - InputStream to compress to
output - OutputStream to which the byte shall be written
Throws:
CompressException - if the Compressor reports an error

decompress

InputStream decompress(File input)
                       throws CompressException
Decompresses a file and returns an InputStream

Parameters:
input - file to decompress
Returns:
the decompressed file as an inputstream
Throws:
CompressException

decompress

InputStream decompress(InputStream input)
                       throws CompressException
Decompresses a file and returns an InputStream

Parameters:
input - inputstream to decompress
Returns:
the decompressed InputStream
Throws:
CompressException

decompressTo

void decompressTo(File input,
                  File output)
                  throws CompressException
Decompresses this file and writes the decompressed byte to the output file

Parameters:
input - File to decompress
output - File to write the decompressed bytes to
Throws:
CompressException - if the Compressor reports an error

decompressTo

void decompressTo(InputStream input,
                  OutputStream output)
                  throws CompressException
Decompresses this file and writes the decompressed file to the output-stream

Parameters:
input - Stream to decompress
output - Stream to write the decompressed bytes to
Throws:
CompressException - if the Compressor reports an error


Copyright © 2011 Apache Software Foundation. All Rights Reserved.