Constructs a ReasonPhrase, validating UTF-8 encoding and length.
The string to use as the reason phrase.
InvalidUTF8Error if encoding fails.
LengthExceedsMaxError if the encoded phrase exceeds MAX_REASON_PHRASE_LEN bytes.
Serializes the ReasonPhrase into a FrozenByteBuffer containing: varint(length_of_phrase_bytes) || phrase_bytes
The serialized buffer.
Static
deserializeDeserializes a ReasonPhrase from the given buffer. Reads varint(length) || utf8‑bytes.
The buffer to read from.
The deserialized ReasonPhrase.
:CastingError if the length cannot be safely cast to a number.
:LengthExceedsMaxError if the length exceeds MAX_REASON_PHRASE_LEN.
:NotEnoughBytesError if the buffer does not contain enough bytes.
:InvalidUTF8Error if decoding fails.
Represents a protocol ReasonPhrase, a short UTF-8 string used for error or status reporting. Enforces a maximum byte length and validates encoding.