Package org.apache.parquet.hadoop.codec
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 Summary
Constructors Constructor Description NonBlockedDecompressor()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description intdecompress(byte[] buffer, int off, int len)Fills specified buffer with uncompressed data.voidend()booleanfinished()intgetRemaining()protected abstract intmaxUncompressedLength(ByteBuffer compressed, int maxUncompressedLength)Get the maximum uncompressed byte size of the given compressed input.booleanneedsDictionary()booleanneedsInput()voidreset()voidsetDictionary(byte[] b, int off, int len)voidsetInput(byte[] buffer, int off, int len)Sets input data for decompression.protected abstract intuncompress(ByteBuffer compressed, ByteBuffer uncompressed)Uncompress the content in the input buffer.
-
-
-
Method Detail
-
decompress
public int decompress(byte[] buffer, int off, int len) throws IOExceptionFills specified buffer with uncompressed data. Returns actual number of bytes of uncompressed data. A return value of 0 indicates thatneedsInput()should be called in order to determine if more input data is required.- Specified by:
decompressin interfaceorg.apache.hadoop.io.compress.Decompressor- Parameters:
buffer- Buffer for the compressed dataoff- Start offset of the datalen- 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 ifneedsInput()returnstrueindicating that more input data is required. (Both native and non-native versions of various Decompressors require that the data passed in viab[]remain unmodified until the caller is explicitly notified--vianeedsInput()--that the buffer may be safely modified. With this requirement, an extra buffer-copy can be avoided.)- Specified by:
setInputin interfaceorg.apache.hadoop.io.compress.Decompressor- Parameters:
buffer- Input dataoff- Start offsetlen- Length
-
end
public void end()
- Specified by:
endin interfaceorg.apache.hadoop.io.compress.Decompressor
-
finished
public boolean finished()
- Specified by:
finishedin interfaceorg.apache.hadoop.io.compress.Decompressor
-
getRemaining
public int getRemaining()
- Specified by:
getRemainingin interfaceorg.apache.hadoop.io.compress.Decompressor
-
needsInput
public boolean needsInput()
- Specified by:
needsInputin interfaceorg.apache.hadoop.io.compress.Decompressor
-
reset
public void reset()
- Specified by:
resetin interfaceorg.apache.hadoop.io.compress.Decompressor
-
needsDictionary
public boolean needsDictionary()
- Specified by:
needsDictionaryin interfaceorg.apache.hadoop.io.compress.Decompressor
-
setDictionary
public void setDictionary(byte[] b, int off, int len)- Specified by:
setDictionaryin interfaceorg.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 datauncompressed- output of the the uncompressed data. It uses buffer[pos()..]- Returns:
- uncompressed data size
- Throws:
IOException
-
-