CborDecoder

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:

override fun deserialize(decoder: Decoder): AlgorithmParameters {
if(decoder is CborDecoder){
val useDefiniteLengthEncoding = (decoder as CborDecoder).cbor.configuration.writeDefiniteLengths
// Do CBOR-specific low-level stuff
}
}

Properties

Link copied to clipboard
abstract val cbor: Cbor

Exposes the current Cbor instance and all its configuration flags. Useful for low-level custom serializers.

Link copied to clipboard

Functions

Link copied to clipboard
Link copied to clipboard
abstract fun decodeBoolean(): Boolean
Link copied to clipboard
abstract fun decodeByte(): Byte
Link copied to clipboard
abstract fun decodeChar(): Char
Link copied to clipboard
abstract fun decodeDouble(): Double
Link copied to clipboard
abstract fun decodeEnum(enumDescriptor: SerialDescriptor): Int
Link copied to clipboard
abstract fun decodeFloat(): Float
Link copied to clipboard
abstract fun decodeInline(descriptor: SerialDescriptor): Decoder
Link copied to clipboard
abstract fun decodeInt(): Int
Link copied to clipboard
abstract fun decodeLong(): Long
Link copied to clipboard
abstract fun decodeNotNullMark(): Boolean
Link copied to clipboard
abstract fun decodeNull(): Nothing?
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
abstract fun decodeShort(): Short
Link copied to clipboard
abstract fun decodeString(): String