Package-level declarations
Types
Built-in Codec for 7-bit ASCII text (US-ASCII, RFC 20). One byte per character on the wire, range 0x00..0x7F.
Canonical DecodeContext / EncodeContext key for the consumer-supplied BufferFactory codecs should use when allocating consumer-owned buffers.
Marker for typed key-value context that flows through codec chains.
Context passed to Decoder.decode / SuspendingDecoder.decode for runtime configuration (allocator hints, max-size guards, version pins, etc.). Contexts are immutable; with returns a new context.
Open base class for decode failures. Protocol layers subclass and attach domain-specific fields (e.g., MqttReasonCode, WebSocketCloseCode).
Key visible only to DecodeContext. Define as a Kotlin object.
Context passed to Encoder.encode for runtime configuration. Contexts are immutable; with returns a new context.
Open base class for encode failures. Protocol layers subclass and attach domain-specific fields.
Key visible only to EncodeContext. Define as a Kotlin object.
Caller-controlled allocator for the opaque bytes a @ForwardCompatible decoder preserves when it skips an unknown sealed variant.
Runtime entry point for the @FramedBy slicing-scheme encode emit. The KSP-generated @FramedBy codec calls encode, which:
Peeks the next frame size from a StreamProcessor without consuming bytes. Streaming loops use this to gate calls to the synchronous Decoder.
Opaque, platform-typed handle for bytes that need to outlive the wire frame they were decoded from — IPC forwarding, persistence, debug capture, default-decode for payloads whose codec isn't pinned at decode time.
Opaque, platform-typed handle for bytes that need to outlive the wire frame they were decoded from — IPC forwarding, persistence, debug capture, default-decode for payloads whose codec isn't pinned at decode time.
JVM + Android actual for OwnedBytesHandle. See common kdoc for design rationale; both jvm and androidTarget source-sets dependsOn jvmCommonMain so this single file serves both.
Opaque, platform-typed handle for bytes that need to outlive the wire frame they were decoded from — IPC forwarding, persistence, debug capture, default-decode for payloads whose codec isn't pinned at decode time.
Opaque, platform-typed handle for bytes that need to outlive the wire frame they were decoded from — IPC forwarding, persistence, debug capture, default-decode for payloads whose codec isn't pinned at decode time.
Canonical Codec for OwnedBytesHandle. Implements buffer-v1 Pattern #2: decode allocates a consumer-owned PlatformBuffer via the factory bound to BufferFactoryKey (falling back to ownedBytesFallbackFactory — BufferFactory.Default on every platform), copies the remaining wire bytes into it, and wraps the result in an OwnedBytesHandle. Encode writes the handle's bytes into the target buffer; wireSize is WireSize.Exact of the carried byte count.
Result of peeking a frame size from a StreamProcessor.
Reads T asynchronously from a pre-bounded ReadBuffer slice.
A Codec for a self-delimiting, variable-width value — one whose encoded length is not a compile-time constant but is always recoverable from the value (for sizing) and from the leading wire bytes (for framing). QUIC varints (RFC 9000 §16), LEB128, protobuf varints, and similar schemes fit; the buffer library ships none of them — a consumer supplies the encoding and the KSP processor provides encoding-agnostic variable-width plumbing.
Result of peeking a self-delimiting value from a StreamProcessor prefix without consuming bytes. Modeled as a sum type (not a nullable) so the two states are explicit and exhaustive.
Functions
Returns a ReadBuffer view over the bytes storage, position reset to 0. The returned view aliases the handle's internal buffer — do not free.
Returns a ReadBuffer view over the bytes storage, position reset to 0. The returned view aliases the handle's internal buffer — do not free.
Returns a ReadBuffer view over the bytes storage, position reset to 0. The returned view aliases the handle's internal buffer — do not free.
Returns a ReadBuffer view over the bytes storage, position reset to 0. The returned view aliases the handle's internal buffer — do not free.
Returns a ReadBuffer view over the bytes storage, position reset to 0. The returned view aliases the handle's internal buffer — do not free.
Number of bytes carried by this handle.
Number of bytes carried by this handle.
Number of bytes carried by this handle.
Number of bytes carried by this handle.
Number of bytes carried by this handle.
Content-equality across two handles.
Content-equality across two handles.
Content-equality across two handles.
Content-equality across two handles.
Content-equality across two handles.
Content hash.
Content hash.
Content hash.
Content hash.
Content hash.
Platform-safe fallback BufferFactory for OwnedBytesHandleCodec when the DecodeContext does not carry a BufferFactoryKey.
Construct from a consumer-owned PlatformBuffer. The platform actual takes ownership of bytes and is responsible for its lifetime.
Construct from a consumer-owned PlatformBuffer. The platform actual takes ownership of bytes and is responsible for its lifetime.
Construct from a consumer-owned PlatformBuffer. The platform actual takes ownership of bytes and is responsible for its lifetime.
Construct from a consumer-owned PlatformBuffer. The platform actual takes ownership of bytes and is responsible for its lifetime.