ProtocolByteAccumulator class
Single reusable buffer for incremental protocol framing.
Incoming stream chunks are appended once. take transfers ownership of the frame bytes (zero-copy view of the prior backing store) so callers that retain the frame (including lazy UTF-8 string cells) keep a live buffer. The accumulator allocates a fresh backing store for subsequent adds.
Constructors
- ProtocolByteAccumulator({int initialCapacity = 64 * 1024})
Properties
Methods
-
add(
Uint8List chunk) → void -
drop(
int count) → void -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
peek(
int count) → Uint8List -
take(
int count) → Uint8List -
Returns a view of the leading
countbytes and releases them from this accumulator. The returned list keeps the previous backing store alive. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited