MagicHeaderAndLengthByteTransformer class

Assembles messages that start with a fixed sequence of zero or more magic bytes followed by a single byte that indicates the length of the rest of the packet. null is accepted as a wildcard byte.

example null magic (will match any header byte) 0x60 0x03 0x01 0x03 0x02 0x10 0x04 0x01 0x02 0x03 0x04

Will clear input if no data is received for at least 1 second.

Implemented types

Constructors

MagicHeaderAndLengthByteTransformer({bool sync = false, bool? cancelOnError, List<int?>? header, int maxLen = 1024, Duration clearTimeout = const Duration(seconds: 1)})
MagicHeaderAndLengthByteTransformer.broadcast({bool sync = false, bool? cancelOnError, List<int?>? header, int maxLen = 1024, Duration clearTimeout = const Duration(seconds: 1)})

Properties

cancelOnError bool?
getter/setter pair
clearTimeout Duration
final
hashCode int
The hash code for this object.
no setterinherited
final
maxLen int
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

bind(Stream<Uint8List> stream) Stream<Uint8List>
Transforms the provided stream.
override
cast<RS, RT>() StreamTransformer<RS, RT>
Provides a StreamTransformer<RS, RT> view of this stream transformer.
override
dispose() → void
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onData(Uint8List data) → void
toString() String
A string representation of this object.
inherited

Operators

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