Companion

Functions

Link copied to clipboard
fun fromOptions(scheme: CoapScheme, destinationHost: String, destinationPort: Int, options: OptionSet): CoapUri

Rebuilds a URI from request options (RFC 7252 §6.5), as a server or proxy sees it: Uri-Host and Uri-Port where present, else destinationHost and destinationPort. For options the application built; the options of a received request are a peer's input and go through fromOptionsOrNull.

Link copied to clipboard
fun fromOptionsOrNull(scheme: CoapScheme, destinationHost: String, destinationPort: Int, options: OptionSet): CoapUri?

Rebuilds a URI like fromOptions, or returns null where fromOptions throws: for the options of a received request, whose Uri-Port of 0 (a valid option, RFC 7252 §5.10.1) or other bad value is the peer's, not the application's.

Link copied to clipboard
fun parse(text: String): CoapUri

Parses an absolute coap, coaps, coap+tcp, coaps+tcp, coap+ws or coaps+ws URI, one the application supplies; a URI from a peer goes through parseOrNull.

Link copied to clipboard

Parses text like parse, or returns null where parse throws. For URIs a peer supplied, such as link targets in a link-format document (RFC 6690 §2) or a URI built from Location-Path and Location-Query (RFC 7252 §5.10.7), whose malformation is the peer's, not the application's.