Package kotlinx.serialization.encoding
Basic concepts of encoding and decoding of serialized data.
Types
A skeleton implementation of both Decoder and CompositeDecoder that can be used for simple formats and for testability purpose. Most of the decode*
methods have default implementation that delegates decodeValue(value: Any) as TargetType
. See Decoder documentation for information about each particular decode*
method.
A skeleton implementation of both Encoder and CompositeEncoder that can be used for simple formats and for testability purpose. Most of the encode*
methods have default implementation that delegates encodeValue(value: Any)
. See Encoder documentation for information about each particular encode*
method.
CompositeDecoder is a part of decoding process that is bound to a particular structured part of the serialized form, described by the serial descriptor passed to Decoder.beginStructure.
CompositeEncoder is a part of encoding process that is bound to a particular structured part of the serialized form, described by the serial descriptor passed to Encoder.beginStructure.
Decoder is a core deserialization primitive that encapsulates the knowledge of the underlying format and an underlying storage, exposing only structural methods to the deserializer, making it completely format-agnostic. Deserialization process takes a decoder and asks him for a sequence of primitive elements, defined by a deserializer serial form, while decoder knows how to retrieve these primitive elements from an actual format representations.
Encoder is a core serialization primitive that encapsulates the knowledge of the underlying format and its storage, exposing only structural methods to the serializer, making it completely format-agnostic. Serialization process transforms a single value into the sequence of its primitive elements, also called its serial form, while encoding transforms these primitive elements into an actual format representation: JSON string, ProtoBuf ByteArray, in-memory map representation etc.
Functions
Begins a structure, decodes it using the given block, ends it and returns decoded element.
Begins a structure, encodes it using the given block and ends it.