useDefiniteLengthEncoding
Parameters
useDefiniteLengthEncoding
Specifies whether the definite length encoding should be used (as required for COSE, for example). CBOR supports two encodings for maps and arrays: definite and indefinite length encoding. kotlinx.serialization defaults to the latter, which means that a map's or array's number of elements is not encoded, but instead a terminating byte is appended after the last element. Definite length encoding, on the other hand, omits this terminating byte, but instead prepends number of elements to the contents of a map or array. This configuration switch allows for toggling between the two modes of encoding.