Package org.apache.hadoop.io.compress
Class PassthroughCodec.StubDecompressor
java.lang.Object
org.apache.hadoop.io.compress.PassthroughCodec.StubDecompressor
- All Implemented Interfaces:
Decompressor
- Enclosing class:
- PassthroughCodec
protected static final class PassthroughCodec.StubDecompressor
extends Object
implements Decompressor
The decompressor is a no-op. It is not needed other than
to complete the methods offered by the interface.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintdecompress(byte[] b, int off, int len) Fills specified buffer with uncompressed data.voidend()Closes the decompressor and discards any unprocessed input.booleanfinished()Returnstrueif the end of the decompressed data output stream has been reached.intReturns the number of bytes remaining in the compressed data buffer.booleanReturnstrueif a preset dictionary is needed for decompression.booleanReturnstrueif the input data buffer is empty andDecompressor.setInput(byte[], int, int)should be called to provide more input.voidreset()Resets decompressor and input and output buffers so that a new set of input data can be processed.voidsetDictionary(byte[] b, int off, int len) Sets preset dictionary for compression.voidsetInput(byte[] b, int off, int len) Sets input data for decompression.
-
Constructor Details
-
StubDecompressor
protected StubDecompressor()
-
-
Method Details
-
setInput
public void setInput(byte[] b, int off, int len) Description copied from interface:DecompressorSets input data for decompression. This should be called if and only ifDecompressor.needsInput()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--viaDecompressor.needsInput()--that the buffer may be safely modified. With this requirement, an extra buffer-copy can be avoided.)- Specified by:
setInputin interfaceDecompressor- Parameters:
b- Input dataoff- Start offsetlen- Length
-
needsInput
public boolean needsInput()Description copied from interface:DecompressorReturnstrueif the input data buffer is empty andDecompressor.setInput(byte[], int, int)should be called to provide more input.- Specified by:
needsInputin interfaceDecompressor- Returns:
trueif the input data buffer is empty andDecompressor.setInput(byte[], int, int)should be called in order to provide more input.
-
setDictionary
public void setDictionary(byte[] b, int off, int len) Description copied from interface:DecompressorSets preset dictionary for compression. A preset dictionary is used when the history buffer can be predetermined.- Specified by:
setDictionaryin interfaceDecompressor- Parameters:
b- Dictionary data bytesoff- Start offsetlen- Length
-
needsDictionary
public boolean needsDictionary()Description copied from interface:DecompressorReturnstrueif a preset dictionary is needed for decompression.- Specified by:
needsDictionaryin interfaceDecompressor- Returns:
trueif a preset dictionary is needed for decompression
-
finished
public boolean finished()Description copied from interface:DecompressorReturnstrueif the end of the decompressed data output stream has been reached. Indicates a concatenated data stream when finished() returnstrueandDecompressor.getRemaining()returns a positive value. finished() will be reset with theDecompressor.reset()method.- Specified by:
finishedin interfaceDecompressor- Returns:
trueif the end of the decompressed data output stream has been reached.
-
decompress
Description copied from interface:DecompressorFills specified buffer with uncompressed data. Returns actual number of bytes of uncompressed data. A return value of 0 indicates thatDecompressor.needsInput()should be called in order to determine if more input data is required.- Specified by:
decompressin interfaceDecompressor- Parameters:
b- Buffer for the uncompressed dataoff- Start offset of the datalen- 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()Description copied from interface:DecompressorReturns the number of bytes remaining in the compressed data buffer. Indicates a concatenated data stream ifDecompressor.finished()returnstrueand getRemaining() returns a positive value. IfDecompressor.finished()returnstrueand getRemaining() returns a zero value, indicates that the end of data stream has been reached and is not a concatenated data stream.- Specified by:
getRemainingin interfaceDecompressor- Returns:
- The number of bytes remaining in the compressed data buffer.
-
reset
public void reset()Description copied from interface:DecompressorResets decompressor and input and output buffers so that a new set of input data can be processed. IfDecompressor.finished()} returnstrueandDecompressor.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 returnfalsewhen reset() is called.- Specified by:
resetin interfaceDecompressor
-
end
public void end()Description copied from interface:DecompressorCloses the decompressor and discards any unprocessed input.- Specified by:
endin interfaceDecompressor
-