Package org.apache.cassandra.io.util
Interface DataInputPlus
- All Superinterfaces:
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
Extension to DataInput that provides support for reading varints
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic classWrapper around an InputStream that provides no buffering but can decode varints -
Method Summary
Modifier and TypeMethodDescriptiondefault longThink hard before opting for an unsigned encoding.default intRead up to a 32-bit integer back.default longreadVInt()Read a 64-bit integer back.default intRead up to a 32-bit integer back.intskipBytes(int n) Always skips the requested number of bytes, unless EOF is reacheddefault voidskipBytesFully(int n) Methods inherited from interface java.io.DataInput
readBoolean, readByte, readChar, readDouble, readFloat, readFully, readFully, readInt, readLine, readLong, readShort, readUnsignedByte, readUnsignedShort, readUTF
-
Method Details
-
readVInt
Read a 64-bit integer back. This method assumes it was originally written usingDataOutputPlus.writeVInt(long)or similar that zigzag encodes the vint.- Throws:
IOException
-
readVInt32
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 integerIOException
-
readUnsignedVInt
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:
IOException
-
readUnsignedVInt32
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 integerIOException
-
skipBytes
Always skips the requested number of bytes, unless EOF is reached- Specified by:
skipBytesin interfaceDataInput- Parameters:
n- number of bytes to skip- Returns:
- number of bytes skipped
- Throws:
IOException
-
skipBytesFully
- Throws:
IOException
-