Decoder class
Streaming SofaBuffers decoder (CORELIB_PLAN §5.2).
Feed arbitrarily small chunks via feed; the state machine suspends and
resumes at any byte boundary. Each feed (and the one-shot decode)
returns the three-valued DecodeStatus describing the bytes consumed so far —
there is no finalize step, and incomplete is never auto-promoted to an
error.
Resuming anywhere is a guarantee, not a tariff: whatever a chunk carries
whole is taken whole — a varint out of it in one read (_fastVarint), a run
of integer array elements 64 bits at a time (_bulkArrElems, the same reader
the one-shot surface uses), an opaque payload in one copy (_bulkPayload) —
and only a field genuinely straddling a boundary falls back to the per-byte
state machine. The hot path touches no heap of its own: every payload lands
in the destination its header call returned, and a float scalar stages in a
reusable slot.
Constructors
- Decoder(MessageVisitor root)
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
-
feed(
List< int> data) → DecodeStatus - Feeds a chunk of raw bytes. Returns the outcome for everything consumed so far (CORELIB_PLAN §5.2).
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
decode(
List< int> bytes, MessageVisitor visitor) → DecodeStatus -
One-shot decode of a whole, already-in-memory
bytesbuffer intovisitor(CORELIB_PLAN §6.1 convenience). This is the common case (deserialize, any message that fits in memory), so it runs the fast contiguous path — advancing an index over the buffer rather than the per-byte streaming state machine — for a large decode speed-up. It produces byte-identical visitor calls and the same DecodeStatus as feeding the same bytes through feed; use a streaming Decoder + feed when the input arrives in chunks.