IsolateByteStreamGenerator class abstract
An IsolateStreamGenerator for building an IsolateStream of
bytes, represented by Uint8List instances.
This could be used e.g. to simulate a large amount of data coming
from a File
or a Socket
. As a convenience, this class
implements sizeOf to count bytes, and bufferSize to give
a reasonably large buffer.
- Inheritance
-
- Object
- IsolateStreamGenerator<
Uint8List> - IsolateByteStreamGenerator
Constructors
Properties
- bufferSize → int
-
Give a resonable default buffer size of 64K bytes.
no setteroverride
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
add(
Uint8List value) → void -
Synchronously send the given value to the consumer, without regard
to respecting the maximum buffer size. If this is
called, the caller must ensure that flushIfNeeded is called
frequently enough to prevent excessive buffer growth.
inherited
-
close(
) → void -
Closes the sink.
inherited
-
flushIfNeeded(
) → Future< void> -
If necessary, pause the sending isolate (the producer) until our
consumer has processed sufficient data.
await x.flushIfNeeded()
should be called regularly, in order to ensure the Send/Receive port buffer between the isolates doesn't get too big.inherited -
generate(
) → Future< void> -
Generate the values for the IsolateStream. An implementation of
this method can send values using the appropriate methods of
this class. When this method returns, the generating isolate is
killed, and the IsolateStream is set as having received its
last element.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
sendValue(
Uint8List value) → Future< void> -
Send the given value to the consumer, pausing if the buffer is
full. This may only be called in the producer isolate.
inherited
-
sizeOf(
Uint8List value) → int -
Give number of bytes this element represents.
override
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited