Top Description Fields Constructors Methods
com.ning.compress.lzf

public Class LZFUncompressor

extends Uncompressor
Class Inheritance
Imports
java.io.IOException, com.ning.compress.BufferRecycler, .DataHandler, .Uncompressor, com.ning.compress.lzf.util.ChunkDecoderFactory

com.ning.compress.Uncompressor implementation for uncompressing LZF encoded data in "push" mode, in which input is not read using java.io.InputStream but rather pushed to uncompressor in variable length chunks.

Field Summary

Modifier and TypeField 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 final ChunkDecoder
_decoder

Underlying decompressor we use for chunk decompression.

protected final 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 final BufferRecycler
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 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_INITIAL

State in which a new block or end-of-stream is expected.

Constructor Summary

AccessConstructor and Description
public
public
LZFUncompressor(DataHandler handler, BufferRecycler bufferRecycler)

public
public

Method Summary

Modifier and TypeMethod and Description
private 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)

public void
complete()

Implements abstract com.ning.compress.Uncompressor.complete.

Method called to indicate that all data to uncompress has already been fed.
public boolean
feedCompressedData(byte[] comp, int offset, int len)

Implements abstract com.ning.compress.Uncompressor.feedCompressedData.

Method called to feed more compressed data to be uncompressed, and sent to possible listeners.

Field Detail

_bytesReadFromBlockback to summary
protected int _bytesReadFromBlock

Number of bytes that have been buffered in _inputBuffer to be uncompressed; or copied directly from uncompressed block.

_compressedLengthback to summary
protected int _compressedLength

Number of bytes in current, compressed block

_decodeBufferback to summary
protected byte[] _decodeBuffer

Buffer used for data uncompressed from _inputBuffer.

_decoderback to summary
protected final ChunkDecoder _decoder

Underlying decompressor we use for chunk decompression.

_handlerback to summary
protected final DataHandler _handler

Handler that will receive uncompressed data.

_inputBufferback to summary
protected byte[] _inputBuffer

Buffer in which compressed input is buffered if necessary, to get full chunks for decoding.

_recyclerback to summary
protected final BufferRecycler _recycler
_stateback to summary
protected int _state

Current decoding state, which determines meaning of following byte(s).

_terminatedback to summary
protected boolean _terminated

Flag set if DataHandler indicates that processing should be terminated.

_uncompressedLengthback to summary
protected int _uncompressedLength

Number of bytes from current block, either after uncompressing data (for compressed blocks), or included in stream (for uncompressed).

STATE_HEADER_COMPRESSED_0back to summary
protected static final int STATE_HEADER_COMPRESSED_0
STATE_HEADER_COMPRESSED_1back to summary
protected static final int STATE_HEADER_COMPRESSED_1
STATE_HEADER_COMPRESSED_2back to summary
protected static final int STATE_HEADER_COMPRESSED_2
STATE_HEADER_COMPRESSED_3back to summary
protected static final int STATE_HEADER_COMPRESSED_3
STATE_HEADER_COMPRESSED_BUFFERINGback to summary
protected static final int STATE_HEADER_COMPRESSED_BUFFERING
STATE_HEADER_UNCOMPRESSED_0back to summary
protected static final int STATE_HEADER_UNCOMPRESSED_0
STATE_HEADER_UNCOMPRESSED_1back to summary
protected static final int STATE_HEADER_UNCOMPRESSED_1
STATE_HEADER_UNCOMPRESSED_STREAMINGback to summary
protected static final int STATE_HEADER_UNCOMPRESSED_STREAMING
STATE_HEADER_Z_GOTTENback to summary
protected static final int STATE_HEADER_Z_GOTTEN
STATE_HEADER_ZV_GOTTENback to summary
protected static final int STATE_HEADER_ZV_GOTTEN
STATE_INITIALback to summary
protected static final int STATE_INITIAL

State in which a new block or end-of-stream is expected.

Constructor Detail

LZFUncompressorback to summary
public LZFUncompressor(DataHandler handler)
LZFUncompressorback to summary
public LZFUncompressor(DataHandler handler, BufferRecycler bufferRecycler)
LZFUncompressorback to summary
public LZFUncompressor(DataHandler handler, ChunkDecoder dec)
LZFUncompressorback to summary
public LZFUncompressor(DataHandler handler, ChunkDecoder dec, BufferRecycler bufferRecycler)

Method Detail

_handleCompressedback to summary
private final int _handleCompressed(byte[] comp, int offset, int end) throws IOException
_handleUncompressedback to summary
private final int _handleUncompressed(byte[] comp, int offset, int end) throws IOException
_reportBadBlockTypeback to summary
protected void _reportBadBlockType(byte[] comp, int nextOffset, int len, int type) throws IOException
_reportBadHeaderback to summary
protected void _reportBadHeader(byte[] comp, int nextOffset, int len, int relative) throws IOException
_uncompressback to summary
private final void _uncompress(byte[] src, int srcOffset, int len) throws IOException
completeback to summary
public void complete() throws IOException

Implements abstract com.ning.compress.Uncompressor.complete.

Doc from com.ning.compress.Uncompressor.complete.

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.

Annotations
@Override
feedCompressedDataback to summary
public boolean feedCompressedData(byte[] comp, int offset, int len) throws IOException

Implements abstract com.ning.compress.Uncompressor.feedCompressedData.

Doc from com.ning.compress.Uncompressor.feedCompressedData.

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

Returns:boolean

True, if caller should process and feed more data; false if caller is not interested in more data and processing should be terminated. (and complete should be called immediately)

Annotations
@Override