StreamReaderState class

As the Persistence class is itself stateless, it uses the StreamReaderState class to maintain and feed it with information from a stream.

The StreamReaderState abstracts away the chunked reading and presents to the outside world a continuous linear interface to the stream.

Constructors

StreamReaderState(Stream<List<int>> _stream, [int? _streamSizeBytesHint])

Properties

bytesRead int
Keeps track of how many bytes have been read so far.
no setter
hashCode int
The hash code for this object.
no setterinherited
remainingStreamBytesHint int?
Returns the number of bytes of the stream that have not been read yet, if known. This is a hint only, and may thus be incorrect - it can only be used to pre-allocate memory in readers in order to hopefully reduce repeated re-allocations, not to determine if the stream is finished. If more bytes have already been read than the hint promised, the result is by definition invalid and null will be returned.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
readByteData(int maxBytes, int bytesMultiple) Future<ByteData>
Reads ByteData of at most maxBytes length (since the stream may not contain that many bytes), but such at the amount read is always a multiple of bytesMultiple.
readBytes(int nrBytesToRead) Future<List<int>?>
Reads a list of bytes of nrBytesToRead bytes from the stream, if possible, or null otherwise (e.g. the stream doesn't contain nrBytesToRead bytes).
readString(int length) Future<String?>
Like readBytes, but returns an ASCII string.
readUint16() Future<int?>
Like readBytes, but reads a Uint16 and returns it as int.
readUint8() Future<int?>
Like readBytes, but reads a single Uint8 and returns it as int.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited