DecodeContext

Context passed to Codec.decode for runtime configuration during decoding.

Use this to pass allocator hints, security policies, compression config, or any other caller-supplied option through the codec chain without global state.

val ctx = DecodeContext.Empty
.with(PngCodec.AllocatorKey, hwAllocator)
.with(MaxSizeKey, 1_000_000)

val result = MyCodec.decode(buffer, ctx)

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
abstract operator fun <T : Any> get(key: CodecContext.Key<T>): T?

Returns the value associated with key, or null if not present.

Link copied to clipboard
abstract fun <T : Any> with(key: CodecContext.Key<T>, value: T): DecodeContext

Returns a new DecodeContext with key set to value. Does not modify this context — contexts are immutable.