Package org.apache.cassandra.io.util
Interface DataInputPlus
-
- All Superinterfaces:
java.io.DataInput
- All Known Subinterfaces:
FileDataInput
,RewindableDataInput
,StreamingDataInputPlus
- All Known Implementing Classes:
AsyncStreamingInputPlus
,ChecksummedDataInput
,CompressedChecksummedDataInput
,CompressedInputStream
,DataInputBuffer
,DataInputPlus.DataInputStreamPlus
,EncryptedChecksummedDataInput
,EncryptedFileSegmentInputStream
,FileInputStreamPlus
,FileSegmentInputStream
,MemoryInputStream
,NIODataInputStream
,RandomAccessReader
,RandomAccessReaderAdapter
,RebufferingInputStream
,StreamCompressionInputStream
,TeeDataInputPlus
,TrackedDataInputPlus
public interface DataInputPlus extends java.io.DataInput
Extension to DataInput that provides support for reading varints
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
DataInputPlus.DataInputStreamPlus
Wrapper around an InputStream that provides no buffering but can decode varints
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default long
readUnsignedVInt()
Think hard before opting for an unsigned encoding.default int
readUnsignedVInt32()
Read up to a 32-bit integer back.default long
readVInt()
Read a 64-bit integer back.default int
readVInt32()
Read up to a 32-bit integer back.int
skipBytes(int n)
Always skips the requested number of bytes, unless EOF is reacheddefault void
skipBytesFully(int n)
-
-
-
Method Detail
-
readVInt
default long readVInt() throws java.io.IOException
Read a 64-bit integer back. This method assumes it was originally written usingDataOutputPlus.writeVInt(long)
or similar that zigzag encodes the vint.- Throws:
java.io.IOException
-
readVInt32
default int readVInt32() throws java.io.IOException
Read up to a 32-bit integer back. This method assumes the integer was originally written usingDataOutputPlus.writeVInt32(int)
or similar that zigzag encodes the vint.- Throws:
VIntCoding.VIntOutOfRangeException
- If the vint doesn't fit into a 32-bit integerjava.io.IOException
-
readUnsignedVInt
default long readUnsignedVInt() throws java.io.IOException
Think hard before opting for an unsigned encoding. Is this going to bite someone because some day they might need to pass in a sentinel value using negative numbers? Is the risk worth it to save a few bytes? Signed, not a fan of unsigned values in protocols and formats- Throws:
java.io.IOException
-
readUnsignedVInt32
default int readUnsignedVInt32() throws java.io.IOException
Read up to a 32-bit integer back. This method assumes the original integer was written usingDataOutputPlus.writeUnsignedVInt32(int)
or similar that doesn't zigzag encodes the vint.- Throws:
VIntCoding.VIntOutOfRangeException
- If the vint doesn't fit into a 32-bit integerjava.io.IOException
-
skipBytes
int skipBytes(int n) throws java.io.IOException
Always skips the requested number of bytes, unless EOF is reached- Specified by:
skipBytes
in interfacejava.io.DataInput
- Parameters:
n
- number of bytes to skip- Returns:
- number of bytes skipped
- Throws:
java.io.IOException
-
skipBytesFully
default void skipBytesFully(int n) throws java.io.IOException
- Throws:
java.io.IOException
-
-