BinaryReaderCore extension

Core properties, operators, and lifecycle methods for BinaryReader.

Provides access to the reader's state (offset,length,availableBytes), random-access operator ([]), byte reading (call), and buffer rebinding (rebind).

Example:

final reader = BinaryReader(Uint8List.fromList([0x00, 0x01, 0x02, 0x03]));
print(reader.offset);    // 0
print(reader[0]);        // 0x00

reader.readUint32();
print(reader.offset);    // 4
print(reader.availableBytes);  // 0

// Rebind to new buffer
reader.rebind(Uint8List.fromList([0xFF]));
print(reader.offset);    // 0
on

Properties

availableBytes int

Available on BinaryReader, provided by the BinaryReaderCore extension

Returns the number of bytes remaining to be read.
no setter
length int

Available on BinaryReader, provided by the BinaryReaderCore extension

Returns the total length of the buffer in bytes.
no setter
offset int

Available on BinaryReader, provided by the BinaryReaderCore extension

Returns the current read position in the buffer.
no setter

Methods

call(int length) Uint8List

Available on BinaryReader, provided by the BinaryReaderCore extension

Reads length bytes from the current position.
rebind(Uint8List buffer) → void

Available on BinaryReader, provided by the BinaryReaderCore extension

Rebinds the reader to a new buffer without creating a new BinaryReader.

Operators

operator [](int index) int

Available on BinaryReader, provided by the BinaryReaderCore extension

Returns the byte at the specified absolute index in the buffer.