Package ca.cgjennings.algo.compression
Class LZMACompressor
- java.lang.Object
-
- ca.cgjennings.algo.compression.AbstractCompressor
-
- ca.cgjennings.algo.compression.LZMACompressor
-
- All Implemented Interfaces:
Compressor
public class LZMACompressor extends AbstractCompressor
ACompressor
that writes a stream of LZMA2 compressed data.- Author:
- Chris Jennings
-
-
Constructor Summary
Constructors Constructor Description LZMACompressor()
Creates a new LZMA compressor at a default compression level.LZMACompressor(int compressionLevel)
Creates a new LZMA compressor with the requested compression level.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
compress(java.io.InputStream in, java.io.OutputStream out)
Reads the data from the input stream, compresses it, and writes it to the output stream.java.io.InputStream
filter(java.io.InputStream in)
Returns an input stream that reads decompresses data from a stream of compressed data.java.io.OutputStream
filter(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, compress, decompress, decompress, decompress, getCompressionLevel, pumpStream, setCompressionLevel, wrap, wrap
-
-
-
-
Constructor Detail
-
LZMACompressor
public LZMACompressor()
Creates a new LZMA compressor at a default compression level.
-
LZMACompressor
public LZMACompressor(int compressionLevel)
Creates a new LZMA compressor with the requested compression level.- Parameters:
compressionLevel
- the compression level, from 0-9
-
-
Method Detail
-
compress
public void compress(java.io.InputStream in, java.io.OutputStream out) throws java.io.IOException
Description copied from interface:Compressor
Reads 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
-
filter
public java.io.OutputStream filter(java.io.OutputStream out) throws java.io.IOException
Description copied from interface:Compressor
Returns 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.IOException
Description copied from interface:Compressor
Returns 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
in
as it is read from - Throws:
java.io.IOException
- if an error occurs while creating the stream
-
-