@InterfaceAudience.Public
@InterfaceStability.Evolving
public interface Decompressor
CompressionInputStream
to compress data.
This is modelled after Inflater
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.
|
boolean |
finished()
Returns
true if the end of the decompressed
data output stream has been reached. |
int |
getRemaining()
Returns the number of bytes remaining in the compressed data buffer.
|
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(byte[], int, int) should be called to
provide more input. |
void |
reset()
Resets decompressor and input and output buffers 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.
|
void setInput(byte[] b, int off, int len)
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 needsInput()
--that the
buffer may be safely modified. With this requirement, an extra
buffer-copy can be avoided.)b
- Input dataoff
- Start offsetlen
- Lengthboolean needsInput()
true
if the input data buffer is empty and
setInput(byte[], int, int)
should be called to
provide more input.true
if the input data buffer is empty and
setInput(byte[], int, int)
should be called in
order to provide more input.void setDictionary(byte[] b, int off, int len)
b
- Dictionary data bytesoff
- Start offsetlen
- Lengthboolean needsDictionary()
true
if a preset dictionary is needed for decompression.true
if a preset dictionary is needed for decompressionboolean finished()
true
if the end of the decompressed
data output stream has been reached. Indicates a concatenated data stream
when finished() returns true
and getRemaining()
returns a positive value. finished() will be reset with the
reset()
method.true
if the end of the decompressed
data output stream has been reached.int decompress(byte[] b, int off, int len) throws IOException
needsInput()
should be called in order to determine if more
input data is required.b
- Buffer for the uncompressed dataoff
- Start offset of the datalen
- Size of the bufferIOException
- raised on errors performing I/O.int getRemaining()
finished()
returns
true
and getRemaining() returns a positive value. If
finished()
returns true
and getRemaining() returns
a zero value, indicates that the end of data stream has been reached and
is not a concatenated data stream.void reset()
finished()
} returns
true
and getRemaining()
returns a positive value,
reset() is called before processing of the next data stream in the
concatenated data stream. finished()
will be reset and will
return false
when reset() is called.void end()
Copyright © 2023 Apache Software Foundation. All rights reserved.