Interface BinaryReader
- All Known Implementing Classes:
SegmentBinaryReader
public interface BinaryReader
An interface for reading binary data sequentially from an underlying source. This provides a
high-level abstraction for zero-copy decoding operations.
-
Method Summary
Modifier and TypeMethodDescriptionlongposition()Gets the current read offset in bytes.voidposition(long newPosition) Sets the current read offset in bytes.booleanbytereadByte()byte[]doubledoublefloatfloatintintlonglongbyte[]booleanreadNullableString(Utf8View viewToPopulate) readSegment(long length) Reads a slice of the underlying data without copying it to the heap.shortshortvoidreadString(Utf8View viewToPopulate) intReads a variable-length 32-bit integer (efficient for small numbers).longReads a variable-length 64-bit integer (efficient for small numbers).longGets the number of remaining readable bytes.voidskip(long bytesToSkip) Skips a specified number of bytes.
-
Method Details
-
position
long position()Gets the current read offset in bytes. -
position
void position(long newPosition) Sets the current read offset in bytes. -
skip
void skip(long bytesToSkip) Skips a specified number of bytes. -
remaining
long remaining()Gets the number of remaining readable bytes. -
readByte
byte readByte() -
readShortBE
short readShortBE() -
readIntBE
int readIntBE() -
readLongBE
long readLongBE() -
readFloatBE
float readFloatBE() -
readDoubleBE
double readDoubleBE() -
readBoolean
boolean readBoolean() -
readShortLE
short readShortLE() -
readIntLE
int readIntLE() -
readLongLE
long readLongLE() -
readFloatLE
float readFloatLE() -
readDoubleLE
double readDoubleLE() -
readVarInt
int readVarInt()Reads a variable-length 32-bit integer (efficient for small numbers). -
readVarLong
long readVarLong()Reads a variable-length 64-bit integer (efficient for small numbers). -
readString
-
readBytes
byte[] readBytes() -
readNullableByte
Byte readNullableByte() -
readNullableShortBE
Short readNullableShortBE() -
readNullableIntBE
Integer readNullableIntBE() -
readNullableLongBE
Long readNullableLongBE() -
readNullableShortLE
Short readNullableShortLE() -
readNullableIntLE
Integer readNullableIntLE() -
readNullableLongLE
Long readNullableLongLE() -
readNullableFloatLE
Float readNullableFloatLE() -
readNullableDoubleLE
Double readNullableDoubleLE() -
readNullableString
-
readNullableBytes
byte[] readNullableBytes() -
readSegment
Reads a slice of the underlying data without copying it to the heap. This is a highly efficient way to process a sub-section of the data.- Parameters:
length- The number of bytes in the slice.- Returns:
- A MemorySegment view of the requested data.
-