public class ZlibDecompressor extends Object implements Decompressor
Decompressor
based on the popular
zlib compression algorithm.
http://www.zlib.net/限定符和类型 | 类和说明 |
---|---|
static class |
ZlibDecompressor.CompressionHeader
The headers to detect from compressed data.
|
构造器和说明 |
---|
ZlibDecompressor() |
ZlibDecompressor(ZlibDecompressor.CompressionHeader header,
int directBufferSize)
Creates a new decompressor.
|
限定符和类型 | 方法和说明 |
---|---|
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 decompressed
data output stream has been reached.
|
long |
getBytesRead()
Returns the total number of compressed bytes input so far.
|
long |
getBytesWritten()
Returns the total number of uncompressed bytes output so far.
|
int |
getRemaining()
Returns the number of bytes remaining in the input buffers; normally
called when finished() is true to determine amount of post-gzip-stream
data.
|
boolean |
needsDictionary()
Returns
true if a preset dictionary is needed for decompression. |
boolean |
needsInput()
Returns true if the input data buffer is empty and
Decompressor.setInput(byte[], int, int) should be called to
provide more input. |
void |
reset()
Resets everything including the input buffers (user and direct).
|
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
Decompressor.needsInput()
returns
true
indicating that more input data is required.
(Both native and non-native versions of various Decompressors require
that the data passed in via b[]
remain unmodified until
the caller is explicitly notified--via Decompressor.needsInput()
--that the
buffer may be safely modified. With this requirement, an extra
buffer-copy can be avoided.)setInput
在接口中 Decompressor
b
- Input dataoff
- Start offsetlen
- Lengthpublic void setDictionary(byte[] b, int off, int len)
Decompressor
setDictionary
在接口中 Decompressor
b
- Dictionary data bytesoff
- Start offsetlen
- Lengthpublic boolean needsInput()
Decompressor
Decompressor.setInput(byte[], int, int)
should be called to
provide more input.needsInput
在接口中 Decompressor
true
if the input data buffer is empty and
Decompressor.setInput(byte[], int, int)
should be called in
order to provide more input.public boolean needsDictionary()
Decompressor
true
if a preset dictionary is needed for decompression.needsDictionary
在接口中 Decompressor
true
if a preset dictionary is needed for decompressionpublic boolean finished()
Decompressor
finished
在接口中 Decompressor
true
if the end of the decompressed
data output stream has been reached.public int decompress(byte[] b, int off, int len) throws IOException
Decompressor
Decompressor.needsInput()
should be called in order to determine if more
input data is required.decompress
在接口中 Decompressor
b
- Buffer for the compressed dataoff
- Start offset of the datalen
- Size of the bufferIOException
public long getBytesWritten()
public long getBytesRead()
public int getRemaining()
getRemaining
在接口中 Decompressor
public void reset()
reset
在接口中 Decompressor
public void end()
Decompressor
end
在接口中 Decompressor
Copyright © 2009 The Apache Software Foundation