Class CompressedInputStream
- java.lang.Object
-
- java.io.InputStream
-
- org.apache.cassandra.io.util.RebufferingInputStream
-
- org.apache.cassandra.db.streaming.CompressedInputStream
-
- All Implemented Interfaces:
java.io.Closeable,java.io.DataInput,java.lang.AutoCloseable,DataInputPlus
public class CompressedInputStream extends RebufferingInputStream implements java.lang.AutoCloseable
InputStream which reads compressed chunks from the underlying input stream and deals with decompression and position tracking. The underlying input will be an instance ofRebufferingInputStreamexcept in some unit tests. Compressed chunks transferred will be a subset of all chunks in the source streamed sstable - just enough to deserialize the requested partition position ranges. Correctness of the entire operation depends on provided partition position ranges and compressed chunks properly matching, and there is no way on the receiving side to verify if that's the case, which arguably makes this a little brittle.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.cassandra.io.util.DataInputPlus
DataInputPlus.DataInputStreamPlus
-
-
Field Summary
-
Fields inherited from class org.apache.cassandra.io.util.RebufferingInputStream
buffer
-
-
Constructor Summary
Constructors Constructor Description CompressedInputStream(DataInputPlus input, CompressionInfo compressionInfo, ChecksumType checksumType, java.util.function.DoubleSupplier validateChecksumChance)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()voidposition(long position)Invoked when crossing into the nextSSTableReader.PartitionPositionBoundssection inCassandraCompressedStreamReader.read(DataInputPlus).protected voidreBuffer()Implementations must implement this method to refill the buffer.-
Methods inherited from class org.apache.cassandra.io.util.RebufferingInputStream
read, read, readBoolean, readByte, readChar, readDouble, readFloat, readFully, readFully, readFully, readInt, readLine, readLong, readPrimitiveSlowly, readShort, readUnsignedByte, readUnsignedShort, readUnsignedVInt, readUTF, readVInt, skipBytes
-
Methods inherited from class java.io.InputStream
available, mark, markSupported, nullInputStream, read, readAllBytes, readNBytes, readNBytes, reset, skip, transferTo
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.cassandra.io.util.DataInputPlus
skipBytesFully
-
-
-
-
Constructor Detail
-
CompressedInputStream
public CompressedInputStream(DataInputPlus input, CompressionInfo compressionInfo, ChecksumType checksumType, java.util.function.DoubleSupplier validateChecksumChance)
- Parameters:
input- Input input to read compressed data fromcompressionInfo- Compression info
-
-
Method Detail
-
position
public void position(long position) throws java.io.IOExceptionInvoked when crossing into the nextSSTableReader.PartitionPositionBoundssection inCassandraCompressedStreamReader.read(DataInputPlus). Will skip 1..n compressed chunks of the original sstable.- Throws:
java.io.IOException
-
reBuffer
protected void reBuffer() throws java.io.IOExceptionDescription copied from class:RebufferingInputStreamImplementations must implement this method to refill the buffer. They can expect the buffer to be empty when this method is invoked.- Specified by:
reBufferin classRebufferingInputStream- Throws:
java.io.IOException
-
close
public void close()
- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Overrides:
closein classjava.io.InputStream
-
-