Class NonBlockedDecompressor

java.lang.Object
org.apache.parquet.hadoop.codec.NonBlockedDecompressor
All Implemented Interfaces:
org.apache.hadoop.io.compress.Decompressor
Direct Known Subclasses:
Lz4RawDecompressor, SnappyDecompressor

public abstract class NonBlockedDecompressor extends Object implements org.apache.hadoop.io.compress.Decompressor
  • Constructor Details

    • NonBlockedDecompressor

      public NonBlockedDecompressor()
  • Method Details

    • decompress

      public int decompress(byte[] buffer, 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 org.apache.hadoop.io.compress.Decompressor
      Parameters:
      buffer - 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 - if reading or decompression fails
    • setInput

      public void setInput(byte[] buffer, 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 org.apache.hadoop.io.compress.Decompressor
      Parameters:
      buffer - Input data
      off - Start offset
      len - Length
    • end

      public void end()
      Specified by:
      end in interface org.apache.hadoop.io.compress.Decompressor
    • finished

      public boolean finished()
      Specified by:
      finished in interface org.apache.hadoop.io.compress.Decompressor
    • getRemaining

      public int getRemaining()
      Specified by:
      getRemaining in interface org.apache.hadoop.io.compress.Decompressor
    • needsInput

      public boolean needsInput()
      Specified by:
      needsInput in interface org.apache.hadoop.io.compress.Decompressor
    • reset

      public void reset()
      Specified by:
      reset in interface org.apache.hadoop.io.compress.Decompressor
    • needsDictionary

      public boolean needsDictionary()
      Specified by:
      needsDictionary in interface org.apache.hadoop.io.compress.Decompressor
    • setDictionary

      public void setDictionary(byte[] b, int off, int len)
      Specified by:
      setDictionary in interface org.apache.hadoop.io.compress.Decompressor
    • maxUncompressedLength

      protected abstract int maxUncompressedLength(ByteBuffer compressed, int maxUncompressedLength) throws IOException
      Get the maximum uncompressed byte size of the given compressed input. This operation takes O(1) time.
      Parameters:
      compressed - input data [pos() ... limit())
      maxUncompressedLength - maximum length of the uncompressed data
      Returns:
      uncompressed byte length of the given input
      Throws:
      IOException
    • uncompress

      protected abstract int uncompress(ByteBuffer compressed, ByteBuffer uncompressed) throws IOException
      Uncompress the content in the input buffer. The result is dumped to the specified output buffer.
      Parameters:
      compressed - buffer[pos() ... limit()) containing the input data
      uncompressed - output of the the uncompressed data. It uses buffer[pos()..]
      Returns:
      uncompressed data size
      Throws:
      IOException