BinaryRange class Null safety
Helper class for decoding binary data.
A binary range is a sequence of bytes to be decoded. A contiguous range from the bytes is tracked by the begin and end indexes into it. As bytes are processed, they are removed from the range by incrementing the begin index.
The binary range maintains a reference to the bytes. It does not make a copy of them. Therefore, the program should not modify the bytes until after the binary range is no longer needed.
Constructors
- BinaryRange(Uint8List bytes, {int? begin, int? end})
-
Creates a new binary range from the
bytes
, starting at thebegin
offset and ending at theend
offset. [...] - BinaryRange.copy(BinaryRange original)
- Creates a new binary range with the same values as another binary range. [...]
Properties
- begin ↔ int
-
The offset into the bytes for the start of the binary range. [...]
read / write
- bytes ↔ Uint8List
-
The underlying data in the binary range.
read / write
- end ↔ int
-
The offset into the bytes for the end of the binary range. [...]
read / write
- hashCode → int
-
The hash code for this object. [...]
read-only, inherited
- isEmpty → bool
-
Tests if there are zero bytes in the range.
read-only
- isNotEmpty → bool
-
Tests if there are one or more bytes in the range.
read-only
- length → int
-
Number of bytes in the range.
read-only
- runtimeType → Type
-
A representation of the runtime type of the object.
read-only, inherited
Methods
-
allRawBytes(
) → Uint8List - Returns a copy of all the bytes in the range. [...]
-
nextBinary(
) → BinaryRange - Extracts an arbitrary length binary string from the range. [...]
-
nextMPInt(
) → BigInt - Extracts a multiple precision integer from the range. [...]
-
nextRawBytes(
int length) → Uint8List - Extract a sequence of bytes from the range. [...]
-
nextString(
{Encoding encoding = utf8}) → String - Extracts an arbitrary length UTF-8 string from the range. [...]
-
nextUint32(
) → int - Extracts a big-endian 32-bit unsigned integer from the range. [...]
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a non-existent method or property is accessed. [...]
inherited
-
toString(
) → String -
A string representation of this object. [...]
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator. [...]
inherited