Codec

interface Codec<T>

Functions

Link copied to clipboard
abstract fun decode(buffer: ReadBuffer): T
Link copied to clipboard
abstract fun encode(buffer: WriteBuffer, value: T)
Link copied to clipboard
fun <T> Codec<T>.encodeToBuffer(value: T, factory: BufferFactory = BufferFactory.Default): ReadBuffer
Link copied to clipboard
open fun sizeOf(value: T): Int?
Link copied to clipboard
fun <T> Codec<T>.testRoundTrip(value: T, expectedBytes: ByteArray? = null, factory: BufferFactory = BufferFactory.Default): T

Testing utility: encodes value, optionally verifies the wire bytes match expectedBytes, then decodes and returns the result. Intended for use in test suites to validate codec correctness.