Package-level declarations
Concise Binary Object Representation (CBOR) format implementation, as per RFC 7049.
Types
Specifies that a ByteArray shall be encoded/decoded as CBOR major type 2: a byte string. For types other than ByteArray, ByteString will have no effect.
Implements encoding and decoding classes to/from bytes using CBOR specification. It is typically used by constructing an application-specific instance, with configured behaviour, and, if necessary, registered custom serializers (in SerializersModule provided by serializersModule constructor parameter).
Encode a class as a CBOR Array (Major type 4) instead of a CBOR map.
Builder of the Cbor instance provided by Cbor
factory function.
Configuration of the current Cbor instance available through Cbor.configuration.
This interface provides access to the current Cbor instance, so it can be properly taken into account in a custom serializer. For example, a custom serializer can decode CBOR data wrapped into a byte array using Cbor.decodeFromByteArray as required by some COSE structures. The actual CBOR Decoder used during deserialization implements this interface, so it is possible to cast the decoder passed to KSerializer.deserialize to CborDecoder when implementing such low-level serializers, to access configuration properties:
This interface provides access to the current Cbor instance, so it can be properly taken into account in a custom serializer. For example, a custom serializer can output a byte array using Cbor.encodeToByteArray and embed resulting data into the output, as required, by some COSE structures. The actual CBOR Encoder used during serialization implements this interface, so it is possible to cast the encoder passed to KSerializer.serialize to CborEncoder when implementing such low-level serializers, to access configuration properties:
CBOR supports keys of all sorts, not just Strings. In the COSE context, these keys are called labels and are limited to Strings and 64-bit negative integers and 64-bit unsigned integers. Conceptually, these work just as SerialName
s, but to also support numbers in addition to Strings, this annotation can be used.
Contains a set of predefined tags, named in accordance with RFC 8949 3.4. Tagging of Items
Specifies that an object of a class annotated using ObjectTags
shall be tagged and serialized as CBOR major type 6: optional semantic tagging of other major types. Can be combined with CborArray and ValueTags. Note that ObjectTags
will always be encoded directly before to the data of the tagged object, i.e. a value-tagged property of an object-tagged type will have the value tags preceding the object tags.
Functions
Creates an instance of Cbor configured from the optionally given Cbor instance and adjusted with builderAction.