Package com.ning.compress.lzf
Class LZFUncompressor
java.lang.Object
com.ning.compress.Uncompressor
com.ning.compress.lzf.LZFUncompressor
Uncompressor
implementation for uncompressing
LZF encoded data in "push" mode, in which input is not
read using InputStream
but rather pushed to
uncompressor in variable length chunks.-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected int
Number of bytes that have been buffered in_inputBuffer
to be uncompressed; or copied directly from uncompressed block.protected int
Number of bytes in current, compressed blockprotected byte[]
Buffer used for data uncompressed from_inputBuffer
.protected final ChunkDecoder
Underlying decompressor we use for chunk decompression.protected final DataHandler
Handler that will receive uncompressed data.protected byte[]
Buffer in which compressed input is buffered if necessary, to get full chunks for decoding.protected final BufferRecycler
protected int
Current decoding state, which determines meaning of following byte(s).protected boolean
Flag set ifDataHandler
indicates that processing should be terminated.protected int
Number of bytes from current block, either after uncompressing data (for compressed blocks), or included in stream (for uncompressed).protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
State in which a new block or end-of-stream is expected. -
Constructor Summary
ConstructorsConstructorDescriptionLZFUncompressor
(DataHandler handler) LZFUncompressor
(DataHandler handler, BufferRecycler bufferRecycler) LZFUncompressor
(DataHandler handler, ChunkDecoder dec) LZFUncompressor
(DataHandler handler, ChunkDecoder dec, BufferRecycler bufferRecycler) -
Method Summary
Modifier and TypeMethodDescriptionprivate final int
_handleCompressed
(byte[] comp, int offset, int end) private final int
_handleUncompressed
(byte[] comp, int offset, int end) protected void
_reportBadBlockType
(byte[] comp, int nextOffset, int len, int type) protected void
_reportBadHeader
(byte[] comp, int nextOffset, int len, int relative) private final void
_uncompress
(byte[] src, int srcOffset, int len) void
complete()
Method called to indicate that all data to uncompress has already been fed.boolean
feedCompressedData
(byte[] comp, int offset, int len) Method called to feed more compressed data to be uncompressed, and sent to possible listeners.
-
Field Details
-
STATE_INITIAL
protected static final int STATE_INITIALState in which a new block or end-of-stream is expected.- See Also:
-
STATE_HEADER_Z_GOTTEN
protected static final int STATE_HEADER_Z_GOTTEN- See Also:
-
STATE_HEADER_ZV_GOTTEN
protected static final int STATE_HEADER_ZV_GOTTEN- See Also:
-
STATE_HEADER_COMPRESSED_0
protected static final int STATE_HEADER_COMPRESSED_0- See Also:
-
STATE_HEADER_COMPRESSED_1
protected static final int STATE_HEADER_COMPRESSED_1- See Also:
-
STATE_HEADER_COMPRESSED_2
protected static final int STATE_HEADER_COMPRESSED_2- See Also:
-
STATE_HEADER_COMPRESSED_3
protected static final int STATE_HEADER_COMPRESSED_3- See Also:
-
STATE_HEADER_COMPRESSED_BUFFERING
protected static final int STATE_HEADER_COMPRESSED_BUFFERING- See Also:
-
STATE_HEADER_UNCOMPRESSED_0
protected static final int STATE_HEADER_UNCOMPRESSED_0- See Also:
-
STATE_HEADER_UNCOMPRESSED_1
protected static final int STATE_HEADER_UNCOMPRESSED_1- See Also:
-
STATE_HEADER_UNCOMPRESSED_STREAMING
protected static final int STATE_HEADER_UNCOMPRESSED_STREAMING- See Also:
-
_handler
Handler that will receive uncompressed data. -
_decoder
Underlying decompressor we use for chunk decompression. -
_recycler
-
_state
protected int _stateCurrent decoding state, which determines meaning of following byte(s). -
_terminated
protected boolean _terminatedFlag set ifDataHandler
indicates that processing should be terminated. -
_compressedLength
protected int _compressedLengthNumber of bytes in current, compressed block -
_uncompressedLength
protected int _uncompressedLengthNumber of bytes from current block, either after uncompressing data (for compressed blocks), or included in stream (for uncompressed). -
_inputBuffer
protected byte[] _inputBufferBuffer in which compressed input is buffered if necessary, to get full chunks for decoding. -
_decodeBuffer
protected byte[] _decodeBufferBuffer used for data uncompressed from_inputBuffer
. -
_bytesReadFromBlock
protected int _bytesReadFromBlockNumber of bytes that have been buffered in_inputBuffer
to be uncompressed; or copied directly from uncompressed block.
-
-
Constructor Details
-
LZFUncompressor
-
LZFUncompressor
-
LZFUncompressor
-
LZFUncompressor
-
-
Method Details
-
feedCompressedData
Description copied from class:Uncompressor
Method called to feed more compressed data to be uncompressed, and sent to possible listeners.NOTE: return value was added (from void to boolean) in 0.9.9
- Specified by:
feedCompressedData
in classUncompressor
- Returns:
- True, if caller should process and feed more data; false if
caller is not interested in more data and processing should be terminated.
(and
Uncompressor.complete()
should be called immediately) - Throws:
IOException
-
complete
Description copied from class:Uncompressor
Method called to indicate that all data to uncompress has already been fed. This typically results in last block of data being uncompressed, and results being sent to listener(s); but may also throw an exception if incomplete block was passed.- Specified by:
complete
in classUncompressor
- Throws:
IOException
-
_handleUncompressed
- Throws:
IOException
-
_handleCompressed
- Throws:
IOException
-
_uncompress
- Throws:
IOException
-
_reportBadHeader
protected void _reportBadHeader(byte[] comp, int nextOffset, int len, int relative) throws IOException - Throws:
IOException
-
_reportBadBlockType
protected void _reportBadBlockType(byte[] comp, int nextOffset, int len, int type) throws IOException - Throws:
IOException
-