|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.hadoop.io.compress.zlib.BuiltInGzipDecompressor
@DoNotPool public class BuiltInGzipDecompressor
A Decompressor
based on the popular gzip compressed file format.
http://www.gzip.org/
Constructor Summary | |
---|---|
BuiltInGzipDecompressor()
Creates a new (pure Java) gzip decompressor. |
Method Summary | |
---|---|
int |
decompress(byte[] b,
int off,
int len)
Decompress the data (gzip header, deflate stream, gzip trailer) in the provided buffer. |
void |
end()
Closes the decompressor and discards any unprocessed input. |
boolean |
finished()
Returns true if the end of the gzip substream (single "member") has been reached. |
long |
getBytesRead()
Returns the total number of compressed bytes input so far, including gzip header/trailer bytes. |
int |
getRemaining()
Returns the number of bytes remaining in the input buffer; 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 buffer, regardless of whether the current gzip substream is finished. |
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public BuiltInGzipDecompressor()
Method Detail |
---|
public boolean needsInput()
Decompressor.setInput(byte[], int, int)
should be called to
provide more input.
needsInput
in interface 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 void setInput(byte[] b, int off, int len)
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
in interface Decompressor
b
- Input dataoff
- Start offsetlen
- Lengthpublic int decompress(byte[] b, int off, int len) throws IOException
decompress
in interface Decompressor
b
- Buffer for the compressed dataoff
- Start offset of the datalen
- Size of the buffer
IOException
public long getBytesRead()
public int getRemaining()
setInput(byte[] b, int off,
int len)
and before decompress(byte[] b, int off, int len)
.
(That is, after decompress(byte[] b, int off, int len)
it
always returns zero, except in finished state with concatenated data.)
getRemaining
in interface Decompressor
public boolean needsDictionary()
true
if a preset dictionary is needed for decompression.
needsDictionary
in interface Decompressor
true
if a preset dictionary is needed for decompressionpublic void setDictionary(byte[] b, int off, int len)
setDictionary
in interface Decompressor
b
- Dictionary data bytesoff
- Start offsetlen
- Lengthpublic boolean finished()
finished
in interface Decompressor
true
if the end of the decompressed
data output stream has been reached.public void reset()
reset
in interface Decompressor
public void end()
end
in interface Decompressor
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |