ChunkedSink class abstract
A codec that gets bytes as they arrive.
The decoders in this package pull: they ask their input for the next field
and the input blocks until it has it. A Stream cannot be read that way, so
this turns the loop around. A subclass keeps its position in fields rather
than on the stack, reads whatever has arrived in step, and returns as soon
as a field is short. The next arrival resumes the parse.
The base handles everything not format-specific: it buffers bytes that arrived and were not read, passes the incoming buffer to the parse when nothing is buffered, and decides what a failure means afterwards.
- Inheritance
-
- Object
- ByteConversionSink
- ChunkedSink
- Implementers
Constructors
-
ChunkedSink(Sink<
List< output)int> >
Properties
- available → int
-
How many bytes have arrived and not been read
no setter
- consumed ↔ int
-
Bytes read so far. A format measures its padding and its own lengths
against this
getter/setter pair
- hashCode → int
-
The hash code for this object.
no setterinherited
-
output
→ Sink<
List< int> > -
Where the result goes, one piece at a time
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- unitAtATime ↔ bool
-
When set, step returns after one unit of the format, a block or a
chunk.
ChunkedSinkDecodersets it, since an input of a few bytes can decode to gigabytes in one call otherwisegetter/setter pair
Methods
-
add(
List< int> chunk) → void -
Adds chunked data to this sink.
override
-
addSlice(
List< int> chunk, int start, int end, bool isLast) → void -
Takes part of a buffer without creating a view of it first, as
ByteConversionSinkallowsoverride -
close(
) → void -
Closes output only if the input ended cleanly. On a failed parse it
stays open, the same as
gzip.decoderandzlib.decoderindart:io, so you have to close your own file or socket. The first close after a failure reports it, and a close after that returns without doing anything, asdart:iodoes.addafter a failure reports it every timeoverride -
finish(
) → void - What the format needs before the input may end. Called once, after the last step, and only when nothing has failed
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
resume(
) → void - Runs the parse again over what is already held, for a subclass that stopped on something other than a short field
-
skip(
int count) → void -
Marks
countbytes as read -
step(
) → void - Reads what has arrived and returns at the first field that is not all here yet. Called again with more bytes behind it
-
toString(
) → String -
A string representation of this object.
inherited
-
view(
int count) → Uint8List -
The next
countbytes without copying them. Only valid until the call that reads them returns, since it may be a view of the incoming piece
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited