Class LZFUncompressor

java.lang.Object
com.ning.compress.Uncompressor
com.ning.compress.lzf.LZFUncompressor

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.
  • Field Details

    • STATE_INITIAL

      protected static final int STATE_INITIAL
      State 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

      protected final DataHandler _handler
      Handler that will receive uncompressed data.
    • _decoder

      protected final ChunkDecoder _decoder
      Underlying decompressor we use for chunk decompression.
    • _recycler

      protected final BufferRecycler _recycler
    • _state

      protected int _state
      Current decoding state, which determines meaning of following byte(s).
    • _terminated

      protected boolean _terminated
      Flag set if DataHandler indicates that processing should be terminated.
    • _compressedLength

      protected int _compressedLength
      Number of bytes in current, compressed block
    • _uncompressedLength

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

      protected byte[] _inputBuffer
      Buffer in which compressed input is buffered if necessary, to get full chunks for decoding.
    • _decodeBuffer

      protected byte[] _decodeBuffer
      Buffer used for data uncompressed from _inputBuffer.
    • _bytesReadFromBlock

      protected int _bytesReadFromBlock
      Number of bytes that have been buffered in _inputBuffer to be uncompressed; or copied directly from uncompressed block.
  • Constructor Details

  • Method Details

    • feedCompressedData

      public boolean feedCompressedData(byte[] comp, int offset, int len) throws IOException
      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 class Uncompressor
      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

      public void complete() throws IOException
      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 class Uncompressor
      Throws:
      IOException
    • _handleUncompressed

      private final int _handleUncompressed(byte[] comp, int offset, int end) throws IOException
      Throws:
      IOException
    • _handleCompressed

      private final int _handleCompressed(byte[] comp, int offset, int end) throws IOException
      Throws:
      IOException
    • _uncompress

      private final void _uncompress(byte[] src, int srcOffset, int len) throws IOException
      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