OptionCodec

The option and payload part shared by every CoAP framing (RFC 7252 §3.1, RFC 8323 §3.2): delta-encoded options, then an optional 0xFF marker followed by a non-empty payload.

Shared with kcoap-oscore, which encodes its plaintext and Class I options with the same rules (RFC 8613 §5.3); not for applications.

Types

Link copied to clipboard
class Parsed(val options: OptionSet, val payload: ByteArray)

Parsed options and the payload that followed them.

Functions

Link copied to clipboard
fun read(bytes: ByteArray, start: Int, end: Int, fail: (String) -> CoapFormatException): OptionCodec.Parsed

Reads options and payload from bytes[start, end); fail builds the exception to throw.

Link copied to clipboard
fun write(options: OptionSet, payload: ByteArray, out: ByteArrayBuilder)

Appends options in number order, then the payload marker and payload when it is not empty.