Package org.apache.hadoop.io.compress
Class CompressionInputStream
java.lang.Object
java.io.InputStream
org.apache.hadoop.io.compress.CompressionInputStream
- All Implemented Interfaces:
Closeable,AutoCloseable,Seekable,org.apache.hadoop.fs.statistics.IOStatisticsSource
- Direct Known Subclasses:
DecompressorStream,SplitCompressionInputStream
@Public
@Evolving
public abstract class CompressionInputStream
extends InputStream
implements Seekable, org.apache.hadoop.fs.statistics.IOStatisticsSource
A compression input stream.
Implementations are assumed to be buffered. This permits clients to
reposition the underlying input stream then call resetState(),
without having to also synchronize client buffers.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final InputStreamThe input stream to be compressed.protected long -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCreate a compression input stream that reads the decompressed bytes from the given stream. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Return any IOStatistics provided by the underlying stream.longgetPos()This method returns the current position in the stream.abstract intread(byte[] b, int off, int len) Read bytes from the stream.abstract voidReset the decompressor to its initial state and discard any buffered data, as the underlying stream may have been repositioned.voidseek(long pos) This method is current not supported.booleanseekToNewSource(long targetPos) This method is current not supported.Methods inherited from class java.io.InputStream
available, mark, markSupported, nullInputStream, read, read, readAllBytes, readNBytes, readNBytes, reset, skip, skipNBytes, transferTo
-
Field Details
-
in
The input stream to be compressed. -
maxAvailableData
protected long maxAvailableData
-
-
Constructor Details
-
CompressionInputStream
Create a compression input stream that reads the decompressed bytes from the given stream.- Parameters:
in- The input stream to be compressed.- Throws:
IOException- raised on errors performing I/O.
-
-
Method Details
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classInputStream- Throws:
IOException
-
getIOStatistics
Return any IOStatistics provided by the underlying stream.- Specified by:
getIOStatisticsin interfaceorg.apache.hadoop.fs.statistics.IOStatisticsSource- Returns:
- IO stats from the inner stream.
-
read
Read bytes from the stream. Made abstract to prevent leakage to underlying stream.- Overrides:
readin classInputStream- Throws:
IOException
-
resetState
Reset the decompressor to its initial state and discard any buffered data, as the underlying stream may have been repositioned.- Throws:
IOException- raised on errors performing I/O.
-
getPos
This method returns the current position in the stream.- Specified by:
getPosin interfaceSeekable- Returns:
- Current position in stream as a long
- Throws:
IOException- raised on errors performing I/O.
-
seek
This method is current not supported.- Specified by:
seekin interfaceSeekable- Parameters:
pos- offset from the start of the file.- Throws:
UnsupportedOperationException- Unsupported Operation Exception.
-
seekToNewSource
This method is current not supported.- Specified by:
seekToNewSourcein interfaceSeekable- Parameters:
targetPos- target position.- Returns:
- true if found a new source, false otherwise.
- Throws:
UnsupportedOperationException- Unsupported Operation Exception.
-