Encoder

interface Encoder<in T>

Encodes typed messages to bytes.

Separated from Decoder so that send-only streams can require only encoding capability. The type system prevents using an encoder where decoding is needed, and vice versa.

Inheritors

Functions

Link copied to clipboard
abstract fun encode(buffer: WriteBuffer, value: T)

Encodes value to buffer at the current position.

Link copied to clipboard
open fun sizeOf(value: T): SizeEstimate

Estimates the encoded size of value for buffer pre-allocation.