public class ZlibDecompressor extends Object implements Decompressor
Decompressor
based on the popular
zlib compression algorithm.
http://www.zlib.net/Modifier and Type | Class and Description |
---|---|
static class |
ZlibDecompressor.CompressionHeader
The headers to detect from compressed data.
|
Constructor and Description |
---|
ZlibDecompressor() |
ZlibDecompressor(ZlibDecompressor.CompressionHeader header,
int directBufferSize)
Creates a new decompressor.
|
Modifier and Type | Method and Description |
---|---|
int |
decompress(byte[] b,
int off,
int len)
Fills specified buffer with uncompressed data.
|
void |
end()
Closes the decompressor and discards any unprocessed input.
|
protected void |
finalize() |
boolean |
finished()
Returns true if the end of the compressed
data output stream has been reached.
|
long |
getBytesRead()
Returns the total number of uncompressed bytes input so far.
|
long |
getBytesWritten()
Returns the total number of compressed bytes output so far.
|
boolean |
needsDictionary()
Returns
true if a preset dictionary is needed for decompression. |
boolean |
needsInput()
Returns true if the input data buffer is empty and
#setInput() should be called to provide more input.
|
void |
reset()
Resets decompressor so that a new set of input data can be processed.
|
void |
setDictionary(byte[] b,
int off,
int len)
Sets preset dictionary for compression.
|
void |
setInput(byte[] b,
int off,
int len)
Sets input data for decompression.
|
public ZlibDecompressor(ZlibDecompressor.CompressionHeader header, int directBufferSize)
public ZlibDecompressor()
public void setInput(byte[] b, int off, int len)
Decompressor
true
indicating that more input data is required.setInput
in interface Decompressor
b
- Input dataoff
- Start offsetlen
- Lengthpublic void setDictionary(byte[] b, int off, int len)
Decompressor
setDictionary
in interface Decompressor
b
- Dictionary data bytesoff
- Start offsetlen
- Lengthpublic boolean needsInput()
Decompressor
needsInput
in interface Decompressor
true
if the input data buffer is empty and
#setInput() should be called in order to provide more input.public boolean needsDictionary()
Decompressor
true
if a preset dictionary is needed for decompression.needsDictionary
in interface Decompressor
true
if a preset dictionary is needed for decompressionpublic boolean finished()
Decompressor
finished
in interface Decompressor
true
if the end of the compressed
data output stream has been reached.public int decompress(byte[] b, int off, int len) throws IOException
Decompressor
decompress
in interface Decompressor
b
- Buffer for the compressed dataoff
- Start offset of the datalen
- Size of the bufferIOException
public long getBytesWritten()
public long getBytesRead()
public void reset()
Decompressor
reset
in interface Decompressor
public void end()
Decompressor
end
in interface Decompressor
Copyright © 2010 The Apache Software Foundation