OwnedBytesHandleCodec

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.

Use as the default codec on a missing-codec path (e.g., MqttCodec's fallback when no per-topic publish codec is registered). For codecs targeting a specific typed Payload (Pattern #1), prefer a direct Codec<MyTypedPayload> rather than routing through this handle.

Functions

Link copied to clipboard
open override fun decode(buffer: ReadBuffer, context: DecodeContext): OwnedBytesHandle
Link copied to clipboard
open override fun encode(buffer: WriteBuffer, value: OwnedBytesHandle, context: EncodeContext)
Link copied to clipboard
open fun peekFrameSize(stream: StreamProcessor, baseOffset: Int = 0): PeekResult
Link copied to clipboard
open override fun wireSize(value: OwnedBytesHandle, context: EncodeContext): WireSize

Reports the on-wire byte size. Defaults to WireSize.BackPatch.