Package-level declarations

Types

Link copied to clipboard

Built-in Codec for 7-bit ASCII text (US-ASCII, RFC 20). One byte per character on the wire, range 0x00..0x7F.

Link copied to clipboard
interface BoundingLengthCodec<T : Any> : Codec<T>

A length Codec that narrows ReadBuffer.limit to bound the subsequent decode region.

Link copied to clipboard
object BufferFactoryKey : CodecKey<BufferFactory>

Canonical DecodeContext / EncodeContext key for the consumer-supplied BufferFactory codecs should use when allocating consumer-owned buffers.

Link copied to clipboard
interface Codec<T> : Encoder<T> , Decoder<T> , FrameDetector

Convenience union of Encoder, Decoder, and FrameDetector.

Link copied to clipboard
interface CodecContext

Marker for typed key-value context that flows through codec chains.

Link copied to clipboard
interface CodecKey<T : Any> : DecodeKey<T> , EncodeKey<T>

Key visible to both directions. Define as a Kotlin object.

Link copied to clipboard

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.

Link copied to clipboard
open class DecodeException(val fieldPath: String, val bufferPosition: Int, val expected: String, val actual: String, cause: Throwable? = null) : IllegalStateException

Open base class for decode failures. Protocol layers subclass and attach domain-specific fields (e.g., MqttReasonCode, WebSocketCloseCode).

Link copied to clipboard
interface DecodeKey<T : Any>

Key visible only to DecodeContext. Define as a Kotlin object.

Link copied to clipboard
interface Decoder<out T>

Reads T synchronously from a pre-bounded ReadBuffer.

Link copied to clipboard

Context passed to Encoder.encode for runtime configuration. Contexts are immutable; with returns a new context.

Link copied to clipboard
open class EncodeException(val fieldPath: String, val reason: String, cause: Throwable? = null) : IllegalStateException

Open base class for encode failures. Protocol layers subclass and attach domain-specific fields.

Link copied to clipboard
interface EncodeKey<T : Any>

Key visible only to EncodeContext. Define as a Kotlin object.

Link copied to clipboard
interface Encoder<in T>

Writes T to a WriteBuffer.

Link copied to clipboard

Runtime entry point for the @FramedBy slicing-scheme encode emit. The KSP-generated @FramedBy codec calls encode, which:

Link copied to clipboard
interface FrameDetector

Peeks the next frame size from a StreamProcessor without consuming bytes. Streaming loops use this to gate calls to the synchronous Decoder.

Link copied to clipboard
expect class OwnedBytesHandle

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.

actual class OwnedBytesHandle
actual class OwnedBytesHandle

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.

actual class OwnedBytesHandle
actual class OwnedBytesHandle
Link copied to clipboard

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.

Link copied to clipboard
interface Payload

Marker interface for self-contained typed payload slot types.

Link copied to clipboard
sealed interface PeekResult

Result of peeking a frame size from a StreamProcessor.

Link copied to clipboard
interface SuspendingDecoder<out T>

Reads T asynchronously from a pre-bounded ReadBuffer slice.

Link copied to clipboard
sealed interface WireSize

Reports the encoded byte size of a value.

Functions

Link copied to clipboard
expect fun OwnedBytesHandle.asReadBuffer(): ReadBuffer

Returns a ReadBuffer view over the bytes storage, position reset to 0. The returned view aliases the handle's internal buffer — do not free.

actual fun OwnedBytesHandle.asReadBuffer(): ReadBuffer
actual fun OwnedBytesHandle.asReadBuffer(): ReadBuffer
actual fun OwnedBytesHandle.asReadBuffer(): ReadBuffer
actual fun OwnedBytesHandle.asReadBuffer(): ReadBuffer
Link copied to clipboard

Number of bytes carried by this handle.

Link copied to clipboard

Content-equality across two handles.

Link copied to clipboard

Content hash.

Link copied to clipboard
fun ownedBytesFallbackFactory(): BufferFactory

Platform-safe fallback BufferFactory for OwnedBytesHandleCodec when the DecodeContext does not carry a BufferFactoryKey.

Link copied to clipboard
expect fun ownedBytesFrom(bytes: PlatformBuffer): OwnedBytesHandle

Construct from a consumer-owned PlatformBuffer. The platform actual takes ownership of bytes and is responsible for its lifetime.

actual fun ownedBytesFrom(bytes: PlatformBuffer): OwnedBytesHandle
actual fun ownedBytesFrom(bytes: PlatformBuffer): OwnedBytesHandle
actual fun ownedBytesFrom(bytes: PlatformBuffer): OwnedBytesHandle
actual fun ownedBytesFrom(bytes: PlatformBuffer): OwnedBytesHandle