Package ca.cgjennings.algo.compression
Class BZip2Compressor
- java.lang.Object
-
- ca.cgjennings.algo.compression.AbstractCompressor
-
- ca.cgjennings.algo.compression.BZip2Compressor
-
- All Implemented Interfaces:
Compressor
public class BZip2Compressor extends AbstractCompressor
ACompressorthat implements the BZip2 compression algorithm.- Since:
- 3.0
- Author:
- Chris Jennings
-
-
Constructor Summary
Constructors Constructor Description BZip2Compressor()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcompress(java.io.File in, java.io.File out)Compresses a file, writing the result to another file.voidcompress(java.io.InputStream in, java.io.OutputStream out)Reads the data from the input stream, compresses it, and writes it to the output stream.voiddecompress(java.io.InputStream in, java.io.OutputStream out)Reads compressed data from the input stream, decompresses it, and writes it to the output stream.java.io.InputStreamfilter(java.io.InputStream in)Returns an input stream that reads decompresses data from a stream of compressed data.java.io.OutputStreamfilter(java.io.OutputStream out)Returns an output stream that compresses data as it writes it to an existing stream.-
Methods inherited from class ca.cgjennings.algo.compression.AbstractCompressor
compress, decompress, decompress, getCompressionLevel, pumpStream, setCompressionLevel, wrap, wrap
-
-
-
-
Method Detail
-
compress
public void compress(java.io.InputStream in, java.io.OutputStream out) throws java.io.IOExceptionDescription copied from interface:CompressorReads the data from the input stream, compresses it, and writes it to the output stream.- Parameters:
in- the source for data to compressout- the sink for compressed data- Throws:
java.io.IOException- if an error occurs during compression
-
decompress
public void decompress(java.io.InputStream in, java.io.OutputStream out) throws java.io.IOExceptionDescription copied from interface:CompressorReads compressed data from the input stream, decompresses it, and writes it to the output stream.- Specified by:
decompressin interfaceCompressor- Overrides:
decompressin classAbstractCompressor- Parameters:
in- the source of data to decompressout- the sink for decompressed data- Throws:
java.io.IOException- if an error occurs during decompression
-
compress
public void compress(java.io.File in, java.io.File out) throws java.io.IOExceptionDescription copied from interface:CompressorCompresses a file, writing the result to another file.- Specified by:
compressin interfaceCompressor- Overrides:
compressin classAbstractCompressor- Parameters:
in- the file to compressout- the destination- Throws:
java.io.IOException- if an error occurs
-
filter
public java.io.OutputStream filter(java.io.OutputStream out) throws java.io.IOExceptionDescription copied from interface:CompressorReturns an output stream that compresses data as it writes it to an existing stream.- Parameters:
out- the stream to write compressed data to- Returns:
- a filter stream that will compress data and write it to
out - Throws:
java.io.IOException- if an error occurs while creating the stream
-
filter
public java.io.InputStream filter(java.io.InputStream in) throws java.io.IOExceptionDescription copied from interface:CompressorReturns an input stream that reads decompresses data from a stream of compressed data.- Parameters:
in- the stream to read compressed data from- Returns:
- a filter stream that will decompress data from
inas it is read from - Throws:
java.io.IOException- if an error occurs while creating the stream
-
-