Data Types

TODO

CBOR Data Types

CBOR in itself has 8 so-called major data types. Those data types represent all information stored in a data stream. Complex information, however, can combine elements in a more meaningful way, as well as tag them to give a clearer meaning.

The common data types are:

Item Type Data Type Description Java Representation

0x00

UInt

Unsigned integer which can hold any positive value up to 64 bits.

byte, short, int, long based on their given (positive) ranges. Larger values are represented as java.math.BigInteger.

0x01

NInt

Negative integer which can hold any negative value up to 64 bits.

byte, short, int, long based on their given (negative) ranges. Larger values are represented as java.math.BigInteger.

0x02

ByteString

A fixed sized byte stream to contain arbitrary encoded or unencoded byte information.

byte[]

0x03

TextString

A string that contains non-ASCII characters and can be encoded in UTF-8. When writing these kinds of strings or reading them from a data stream encoding and decoding takes place.

java.lang.String

0x04

Sequence or Array or List

A container element that contains a stream of an either fixed or indefinite number of further elements.

com.noctarius.borabora.Sequence or java.util.Iterable<Value>.

0x05

Dictionary or Map

A container element that contains a stream of an either fixed or indefinite number of key-value pairs of elements.

com.noctarius.borabora.Dictionary or java.util.Iterable<Map.Entry<Value, Value>>

0x06

Semantic Tag

A semantic tag is used as an additional tagging in front of another element. The tag tells the parser that the following item is further specified. A classic example is a DateTime-Tag (TagId: 0) to tell the parser that the following ByteString will represent a date and time element.

Depends on the semantic tag’s id. A meaningful Java 8 representation of the CBOR’s data item. That said date and time elements, for example, will return values of the new Java 8 DateTime API but understand Calendar and Date based values.

0x07

Floating Point or Simple Value

This data type is more complex, as some content encodes simple values like null, true or false. On the other hand half, single or double precision float values will be stored. Values can be positive or negative.

com.noctarius.borabora.HalfPrecisionFloat, float or double, if the value is larger than the representation of those data types, a java.math.BigDecimal is used.

Apart from those basic major types, borabora has a number of built-in semantic tags to support a variety of additional data types.

Provided Extension Types

TODO

borabora Data Types

TODO

The Value Class

TODO

Sequences

TODO

Dictionaries

TODO

results matching ""

    No results matching ""