Class Lz4Decompressor

java.lang.Object
org.apache.hadoop.io.compress.lz4.Lz4Decompressor
All Implemented Interfaces:
Decompressor

public class Lz4Decompressor extends Object implements Decompressor
A Decompressor based on the lz4 compression algorithm. http://code.google.com/p/lz4/
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a new decompressor with the default buffer size.
    Lz4Decompressor(int directBufferSize)
    Creates a new compressor.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    decompress(byte[] b, int off, int len)
    Fills specified buffer with uncompressed data.
    void
    end()
    Resets decompressor and input and output buffers so that a new set of input data can be processed.
    boolean
    Returns true if the end of the decompressed data output stream has been reached.
    int
    Returns 0.
    boolean
    Returns false.
    boolean
    Returns true if the input data buffer is empty and setInput(byte[], int, int) should be called to provide more input.
    void
    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)
    Does nothing.
    void
    setInput(byte[] b, int off, int len)
    Sets input data for decompression.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Lz4Decompressor

      public Lz4Decompressor(int directBufferSize)
      Creates a new compressor.
      Parameters:
      directBufferSize - size of the direct buffer to be used.
    • Lz4Decompressor

      public Lz4Decompressor()
      Creates a new decompressor with the default buffer size.
  • Method Details

    • setInput

      public void setInput(byte[] b, int off, int len)
      Sets input data for decompression. This should be called if and only if 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.)
      Specified by:
      setInput in interface Decompressor
      Parameters:
      b - Input data
      off - Start offset
      len - Length
    • setDictionary

      public void setDictionary(byte[] b, int off, int len)
      Does nothing.
      Specified by:
      setDictionary in interface Decompressor
      Parameters:
      b - Dictionary data bytes
      off - Start offset
      len - Length
    • needsInput

      public boolean needsInput()
      Returns true if the input data buffer is empty and setInput(byte[], int, int) should be called to provide more input.
      Specified by:
      needsInput in interface Decompressor
      Returns:
      true if the input data buffer is empty and setInput(byte[], int, int) should be called in order to provide more input.
    • needsDictionary

      public boolean needsDictionary()
      Returns false.
      Specified by:
      needsDictionary in interface Decompressor
      Returns:
      false.
    • finished

      public boolean finished()
      Returns true if the end of the decompressed data output stream has been reached.
      Specified by:
      finished in interface Decompressor
      Returns:
      true if the end of the decompressed data output stream has been reached.
    • decompress

      public int decompress(byte[] b, int off, int len) throws IOException
      Fills specified buffer with uncompressed data. Returns actual number of bytes of uncompressed data. A return value of 0 indicates that needsInput() should be called in order to determine if more input data is required.
      Specified by:
      decompress in interface Decompressor
      Parameters:
      b - Buffer for the compressed data
      off - Start offset of the data
      len - Size of the buffer
      Returns:
      The actual number of bytes of uncompressed data.
      Throws:
      IOException - raised on errors performing I/O.
    • getRemaining

      public int getRemaining()
      Returns 0.
      Specified by:
      getRemaining in interface Decompressor
      Returns:
      0.
    • reset

      public void reset()
      Description copied from interface: Decompressor
      Resets decompressor and input and output buffers so that a new set of input data can be processed. If Decompressor.finished()} returns true and Decompressor.getRemaining() returns a positive value, reset() is called before processing of the next data stream in the concatenated data stream. Decompressor.finished() will be reset and will return false when reset() is called.
      Specified by:
      reset in interface Decompressor
    • end

      public void end()
      Resets decompressor and input and output buffers so that a new set of input data can be processed.
      Specified by:
      end in interface Decompressor