public interface Compressor
Modifier and Type | Interface and Description |
---|---|
static class |
Compressor.COMPRESSOR_TYPE |
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
DEFAULT_COMPRESSORDESCRIPTOR |
Modifier and Type | Method and Description |
---|---|
Bucket |
compress(Bucket data,
BucketFactory bf,
long maxReadLength,
long maxWriteLength)
Compress the data.
|
long |
compress(java.io.InputStream input,
java.io.OutputStream output,
long maxReadLength,
long maxWriteLength)
Compress the data.
|
long |
compress(java.io.InputStream input,
java.io.OutputStream output,
long maxReadLength,
long maxWriteLength,
long amountOfDataToCheckCompressionRatio,
int minimumCompressionPercentage)
Compress the data (@see
compress(InputStream, OutputStream, long, long) ) with checking of compression effect. |
int |
decompress(byte[] dbuf,
int i,
int j,
byte[] output)
Decompress in RAM only.
|
long |
decompress(java.io.InputStream input,
java.io.OutputStream output,
long maxLength,
long maxEstimateSizeLength)
Decompress data.
|
static final java.lang.String DEFAULT_COMPRESSORDESCRIPTOR
Bucket compress(Bucket data, BucketFactory bf, long maxReadLength, long maxWriteLength) throws java.io.IOException, CompressionOutputSizeException
data
- The bucket to read from.bf
- The means to create a new bucket.maxReadLength
- The maximum number of bytes to read from the input bucket.maxWriteLength
- The maximum number of bytes to write to the output bucket. If this is exceeded, throw a CompressionOutputSizeException.java.io.IOException
- If an error occurs reading or writing data.CompressionOutputSizeException
- If the compressed data is larger than maxWriteLength.long compress(java.io.InputStream input, java.io.OutputStream output, long maxReadLength, long maxWriteLength) throws java.io.IOException, CompressionOutputSizeException
input
- The InputStream to read from.output
- The OutputStream to write to.maxReadLength
- The maximum number of bytes to read from the input bucket.maxWriteLength
- The maximum number of bytes to write to the output bucket. If this is exceeded, throw a CompressionOutputSizeException.java.io.IOException
- If an error occurs reading or writing data.CompressionOutputSizeException
- If the compressed data is larger than maxWriteLength.long compress(java.io.InputStream input, java.io.OutputStream output, long maxReadLength, long maxWriteLength, long amountOfDataToCheckCompressionRatio, int minimumCompressionPercentage) throws java.io.IOException, CompressionRatioException
compress(InputStream, OutputStream, long, long)
) with checking of compression effect.amountOfDataToCheckCompressionRatio
- The data amount after compression of which we will check whether we have got the desired effect.minimumCompressionPercentage
- The minimal desired compression effect, %. A value of 0 means that the
compression effect will not be checked.CompressionRatioException
- If the desired compression effect is not achieved.java.io.IOException
long decompress(java.io.InputStream input, java.io.OutputStream output, long maxLength, long maxEstimateSizeLength) throws java.io.IOException, CompressionOutputSizeException
input
- Where to read the data to decompress fromoutput
- Where to write the final product tomaxLength
- The maximum length to decompress (we throw if more is present).maxEstimateSizeLength
- If the data is too big, and this is >0, read up to this many bytes in order to try to get the data size.java.io.IOException
CompressionOutputSizeException
int decompress(byte[] dbuf, int i, int j, byte[] output) throws CompressionOutputSizeException
dbuf
- Input buffer.i
- Offset to start reading from.j
- Number of bytes to read.output
- Output buffer.DecompressException
CompressionOutputSizeException