MemPtr class

A helper class to work with List and TypedData in a way similar to pointers in C.

Constructors

MemPtr(List<int> other, [int offset = 0, int _length = -1, int byteOrder = LITTLE_ENDIAN])
MemPtr.from(MemPtr other, [int offset = 0, int _length = -1])

Properties

buffer List<int>
getter/setter pair
byteOrder int
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
isEOS bool
Are we at the end of the buffer?
no setter
length int
The number of bytes remaining in the buffer.
no setter
offset int
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

memcpy(int start, int length, dynamic other, [int offset = 0]) → void
Copy data from other to this buffer, at start offset from the current read position, and length number of bytes. offset is the offset in other to start reading.
memset(int start, int length, int value) → void
Set a range of bytes in this buffer to value, at start offset from the current read position, and length number of bytes.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
readByte() int
Read a single byte.
readBytes(int count) List<int>
Read count bytes from the buffer.
readString([int? len]) String
Read a null-terminated string, or if len is provided, that number of bytes returned as a string.
readUint16() int
Read a 16-bit word from the stream.
readUint24() int
Read a 24-bit word from the stream.
readUint32() int
Read a 32-bit word from the stream.
toString() String
A string representation of this object.
inherited
toUint32List([int offset = 0]) Uint32List?
This assumes buffer is a Typed
toUint8List([int offset = 0]) Uint8List?
This assumes buffer is a Typed

Operators

operator ==(Object other) bool
The equality operator.
inherited
operator [](int index) int
Get a byte in the buffer relative to the current read position.
operator []=(int index, int value) → void
Set a byte in the buffer relative to the current read position.