DelimitedReader class
A reader for reading length-prefixed protocol buffer messages.
The gogo protobuf NewDelimitedReader is buffered, which may eat up stream data. So we need to implement a compatible delimited reader that reads unbuffered. There is a slowdown from unbuffered reading: when reading the message it can take multiple single byte Reads to read the length and another Read to read the message payload. However, this is not critical performance degradation as
- the reader is utilized to read one (dialer, stop) or two messages (hop) during the handshake, so it's a drop in the water for the connection lifetime.
- messages are small (max 4k) and the length fits in a couple of bytes, so overall we have at most three reads per message.
Constructors
-
DelimitedReader.new(Stream<
List< _stream, int _maxSize)int> >
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- 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
-
readMsg<
T extends GeneratedMessage> (T message) → Future< T> - Reads a protocol buffer message from the stream.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited