Table of Contents

Enum DecodeStatus

Namespace
sofab
Assembly
SofaBuffers.dll

The terminal outcome of a decode (MESSAGE_SPEC §7), reported identically for one-shot and streaming decode with no finish / finalize / end promotion step.

public enum DecodeStatus

Fields

Complete = 0

The bytes ended exactly at a field boundary — a valid message.

Incomplete = 1

The bytes ended inside a field (an unterminated varint, an unfinished fixlen / array payload, or a still-open nested sequence); more bytes could complete it. Not an error — the caller owns end-of-input.

Invalid = 2

The bytes are malformed regardless of what follows. Never returned by Feed: it throws SofabException (InvalidMessage) instead, and the verdict is terminal, so every later Feed throws the same exception. This member names the outcome §5.2.1 defines — the value a caller catches rather than reads.

Remarks

Feed(byte[], IVisitor) returns Complete when the bytes consumed so far end exactly at a field boundary, or Incomplete when they end inside a field — a partial varint, a payload shorter than its declared length, an array that runs off the end, or a nested sequence never closed. Incomplete is not an error: more bytes could complete the message, and the caller owns end-of-input, deciding whether a trailing Incomplete is a truncation error for its protocol.

Invalid input — malformed regardless of what follows — is never returned: Feed throws SofabException with InvalidMessage instead, the error channel carrying the refusal and its code (§6.3). That verdict is terminal, and the decoder latches it: every later Feed throws again rather than resuming a stream already known to be malformed. There is no status accessor to consult alongside the return value — what Feed hands back is the whole answer.

This mirrors the Go port's ErrIncomplete sentinel and the TypeScript port's DecodeStatus — a distinct INCOMPLETE outcome that a caller tells apart from a clean COMPLETE return and from the INVALID throw.