Builder

class Builder(nameSpacedDataToCopyFrom: NameSpacedData? = null)

A builder for NameSpacedData.

The nameSpacedDataToCopyFrom parameter is useful in situations where you want to create a NameSpacedData with the same data as a given one except for needing to change one or more data elements.

Parameters

nameSpacedDataToCopyFrom

the NameSpacedData to copy all data from or null.

Constructors

Link copied to clipboard
constructor(nameSpacedDataToCopyFrom: NameSpacedData? = null)

Functions

Link copied to clipboard

Builds a NameSpacedData from the builder

Link copied to clipboard
fun putEntry(nameSpaceName: String, dataElementName: String, value: ByteArray): NameSpacedData.Builder

Adds a raw CBOR value to the builder.

Link copied to clipboard
fun putEntryBoolean(nameSpaceName: String, dataElementName: String, value: Boolean): NameSpacedData.Builder

Encode the given value as a boolean and adds it to the builder.

Link copied to clipboard
fun putEntryByteString(nameSpaceName: String, dataElementName: String, value: ByteArray): NameSpacedData.Builder

Encode the given value as bstr CBOR and adds it to the builder.

Link copied to clipboard
fun putEntryNumber(nameSpaceName: String, dataElementName: String, value: Long): NameSpacedData.Builder

Encode the given value as an integer or unsigned integer and adds it to the builder.

Link copied to clipboard
fun putEntryString(nameSpaceName: String, dataElementName: String, value: String): NameSpacedData.Builder

Encode the given value as tstr CBOR and adds it to the builder.