Enum Class DecodeStatus

java.lang.Object
java.lang.Enum<DecodeStatus>
org.sofabuffers.sofab.DecodeStatus
All Implemented Interfaces:
Serializable, Comparable<DecodeStatus>, Constable

public enum DecodeStatus extends Enum<DecodeStatus>
The outcome of a decode, per the finish-less three-valued model of CORELIB_PLAN §5.2.1 / MESSAGE_SPEC §7. It is identical for one-shot and streaming decodes, it describes the bytes consumed so far, and there is no finish/finalize step: "the status feed returns is the answer" (§5.2.4), and the caller owns end-of-input.
  • COMPLETE — the consumed bytes end exactly at a field boundary (a valid message).
  • INCOMPLETE — the consumed bytes end inside a field (a partial varint, a fixlen/array payload shorter than declared) or with an open, unclosed sequence. This is not an error: more bytes could complete the message, and the caller decides whether a trailing INCOMPLETE is a truncation it cares about.
  • INVALID — the bytes are malformed regardless of what follows (varint over 64 bits, bad type/subtype tag, length/count/id over max, dangling sequence-end, nesting past MAX_DEPTH, invalid UTF-8). It names the third outcome; it is not a value IStream.feed(byte[], Visitor) returns, because this library carries a refusal on the error channel — see below.

Which of the three feed returns. IStream.feed(byte[], Visitor) returns COMPLETE or INCOMPLETE — the two outcomes more bytes can still change. INVALID arrives instead as a thrown SofabException carrying SofabError.INVALID_MSG, the code §6.3 pairs with this outcome ("INVALID corresponds to InvalidMessage"), and the same exception channel carries SofabError.LIMIT_EXCEEDED, the receiver-cap refusal of well-formed bytes that §6.3 keeps distinct from it. §6.0 names the three outcomes; it does not prescribe the carrier, and refusals leave by the one route a Java caller cannot ignore. Both are terminal: the decoder latches them and every further feed re-throws until IStream.reset().

  • Enum Constant Details

    • COMPLETE

      public static final DecodeStatus COMPLETE
      The consumed bytes end exactly at a field boundary — a valid message.
    • INCOMPLETE

      public static final DecodeStatus INCOMPLETE
      The consumed bytes end inside a field or with an open sequence; more bytes could complete the message. Not an error.
    • INVALID

      public static final DecodeStatus INVALID
      The bytes are malformed regardless of what follows — the third outcome of §5.2.1, and the one IStream.feed(byte[], Visitor) does not return: it throws a SofabException with SofabError.INVALID_MSG instead, then latches the verdict so no continuation can revise it and every further feed throws again until IStream.reset().
  • Method Details

    • values

      public static DecodeStatus[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static DecodeStatus valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null