public class LZFUncompressor extends Uncompressor
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.Modifier and Type | Field and Description |
---|---|
protected int |
_bytesReadFromBlock
Number of bytes that have been buffered in
_inputBuffer to be
uncompressed; or copied directly from uncompressed block. |
protected int |
_compressedLength
Number of bytes in current, compressed block
|
protected byte[] |
_decodeBuffer
Buffer used for data uncompressed from
_inputBuffer . |
protected ChunkDecoder |
_decoder
Underlying decompressor we use for chunk decompression.
|
protected DataHandler |
_handler
Handler that will receive uncompressed data.
|
protected byte[] |
_inputBuffer
Buffer in which compressed input is buffered if necessary, to get
full chunks for decoding.
|
protected BufferRecycler |
_recycler |
protected int |
_state
Current decoding state, which determines meaning of following byte(s).
|
protected boolean |
_terminated
Flag set if
DataHandler indicates that processing should be
terminated. |
protected int |
_uncompressedLength
Number of bytes from current block, either after uncompressing data
(for compressed blocks), or included in stream (for uncompressed).
|
protected static int |
STATE_HEADER_COMPRESSED_0 |
protected static int |
STATE_HEADER_COMPRESSED_1 |
protected static int |
STATE_HEADER_COMPRESSED_2 |
protected static int |
STATE_HEADER_COMPRESSED_3 |
protected static int |
STATE_HEADER_COMPRESSED_BUFFERING |
protected static int |
STATE_HEADER_UNCOMPRESSED_0 |
protected static int |
STATE_HEADER_UNCOMPRESSED_1 |
protected static int |
STATE_HEADER_UNCOMPRESSED_STREAMING |
protected static int |
STATE_HEADER_Z_GOTTEN |
protected static int |
STATE_HEADER_ZV_GOTTEN |
protected static int |
STATE_INITIAL
State in which a new block or end-of-stream is expected.
|
Constructor and Description |
---|
LZFUncompressor(DataHandler handler) |
LZFUncompressor(DataHandler handler,
BufferRecycler bufferRecycler) |
LZFUncompressor(DataHandler handler,
ChunkDecoder dec) |
LZFUncompressor(DataHandler handler,
ChunkDecoder dec,
BufferRecycler bufferRecycler) |
Modifier and Type | Method and Description |
---|---|
protected void |
_reportBadBlockType(byte[] comp,
int nextOffset,
int len,
int type) |
protected void |
_reportBadHeader(byte[] comp,
int nextOffset,
int len,
int relative) |
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.
|
protected static final int STATE_INITIAL
protected static final int STATE_HEADER_Z_GOTTEN
protected static final int STATE_HEADER_ZV_GOTTEN
protected static final int STATE_HEADER_COMPRESSED_0
protected static final int STATE_HEADER_COMPRESSED_1
protected static final int STATE_HEADER_COMPRESSED_2
protected static final int STATE_HEADER_COMPRESSED_3
protected static final int STATE_HEADER_COMPRESSED_BUFFERING
protected static final int STATE_HEADER_UNCOMPRESSED_0
protected static final int STATE_HEADER_UNCOMPRESSED_1
protected static final int STATE_HEADER_UNCOMPRESSED_STREAMING
protected final DataHandler _handler
protected final ChunkDecoder _decoder
protected final BufferRecycler _recycler
protected int _state
protected boolean _terminated
DataHandler
indicates that processing should be
terminated.protected int _compressedLength
protected int _uncompressedLength
protected byte[] _inputBuffer
protected byte[] _decodeBuffer
_inputBuffer
.protected int _bytesReadFromBlock
_inputBuffer
to be
uncompressed; or copied directly from uncompressed block.public LZFUncompressor(DataHandler handler)
public LZFUncompressor(DataHandler handler, BufferRecycler bufferRecycler)
public LZFUncompressor(DataHandler handler, ChunkDecoder dec)
public LZFUncompressor(DataHandler handler, ChunkDecoder dec, BufferRecycler bufferRecycler)
public boolean feedCompressedData(byte[] comp, int offset, int len) throws IOException
Uncompressor
NOTE: return value was added (from void to boolean) in 0.9.9
feedCompressedData
in class Uncompressor
Uncompressor.complete()
should be called immediately)IOException
public void complete() throws IOException
Uncompressor
complete
in class Uncompressor
IOException
protected void _reportBadHeader(byte[] comp, int nextOffset, int len, int relative) throws IOException
IOException
protected void _reportBadBlockType(byte[] comp, int nextOffset, int len, int type) throws IOException
IOException
Copyright © 2023. All rights reserved.