InputBuffer class

A buffer that can be read as a stream of bytes.

Constructors

InputBuffer(List<int> buffer, {bool bigEndian = false, int offset = 0, int? length})
Create a InputStream for reading from a List
InputBuffer.from(InputBuffer other, {int offset = 0, int? length})
Create a copy of other.

Properties

bigEndian bool
getter/setter pair
buffer List<int>
getter/setter pair
end int
final
hashCode int
The hash code for this object.
no setterinherited
isEOS bool
Is the current position at the end of the stream?
no setter
length int
How many bytes are left in the stream.
no setter
offset int
getter/setter pair
position int
The current read position relative to the start of the buffer.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
start int
final

Methods

indexOf(int value, [int offset = 0]) int
Returns the position of the given value within the buffer, starting from the current read position with the given offset. The position returned is relative to the start of the buffer, or -1 if the value was not found.
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
peekBytes(int count, [int offset = 0]) InputBuffer
Read count bytes from an offset of the current read position, without moving the read position.
readByte() int
Read a single byte.
readBytes(int count) InputBuffer
Read count bytes from the stream.
readFloat32() double
Read a 32-bit float.
readFloat64() double
Read a 64-bit float.
readInt16() int
Read a 16-bit word from the stream.
readInt32() int
Read a signed 32-bit integer from the stream.
readInt8() int
readString([int? len]) String
Read a null-terminated string, or if len is provided, that number of bytes returned as a string.
readStringUtf8() String
Read a null-terminated UTF-8 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.
readUint64() int
Read a 64-bit word form the stream.
rewind() → void
Reset to the beginning of the stream.
skip(int count) → void
Move the read position by count bytes.
subset(int count, {int? position, int offset = 0}) InputBuffer
Return a InputStream to read a subset of this stream. It does not move the read position of this stream. position is specified relative to the start of the buffer. If position is not specified, the current read position is used. If length is not specified, the remainder of this stream is used.
toList([int offset = 0, int length = 0]) List<int>
toString() String
A string representation of this object.
inherited
toUint32List([int offset = 0]) Uint32List
toUint8List([int offset = 0, int? length]) Uint8List

Operators

operator ==(Object other) bool
The equality operator.
inherited
operator [](int index) int
Access the buffer relative from the current position.
operator []=(int index, int value) → void
Set a buffer element relative to the current position.