io.bullet.borer
Type members
Classlikes
An AdtDecoder is a Decoder whose read
method expects to read an envelope
(holding the type id) around the actual value encoding.
An AdtDecoder is a Decoder whose read
method expects to read an envelope
(holding the type id) around the actual value encoding.
In order to be able to collapse several envelope levels into a single one, when several AdtDecoder instances
call each other, this type also provides read
overloads which don't read the type id envelope themselves
but can receive the type id from the outside.
An AdtEncoder is an Encoder which encodes its values with an envelope holding the value's type id.
An AdtEncoder is an Encoder which encodes its values with an envelope holding the value's type id.
It doesn't change or add to the outside interface of Encoder but merely serves as a marker signaling that it takes on the responsibility of encoding the type id in addition to the value itself. This allows outside encoders calling an AdtEncoder to delegate this responsibility rather than performing the task themselves.
A simple encapsulation of an Encoder and Decoder for the same type, as one entity.
Sometimes it's easier to supply just a single implicit for a type, rather than two. As an alternative to writing a separate Encoder and Decoder for type A you can also write a Codec for A. (Encoder and Decoder can be implicitly "unpacked" from a codec.)
However, in order to not hinder composability Codecs should only ever be supplied, never consumed.
So, if you write an encoder, decoder or codec for a generic type, which itself requires implicitly
available encoders and/or decoders for certain type parameters (like Encoder.forOption
, for example)
then you should never require implicitly available Codecs, but rather Encoders and Decoders separately.
- Companion:
- object
A simple mapping of CBOR data item types to bits for efficient masking.
A simple mapping of CBOR data item types to bits for efficient masking.
Wrapper for Float value that gets encoded to and decoded from 16-bit Half-Precision Floats (two-byte IEEE 754).
Wrapper for Float value that gets encoded to and decoded from 16-bit Half-Precision Floats (two-byte IEEE 754).
- Companion:
- object
Logic for converting half-precision (16-bit) floats to and from bytes.
Logic for converting half-precision (16-bit) floats to and from bytes.
Source: https://stackoverflow.com/questions/6162651 (The author says it's public domain.)
The documented author's "extensions" have been removed for clean round-tripping to and from Float.
- Companion:
- class
Mutable abstraction wrapping some source of bytes to serve as parser input.
Mutable abstraction wrapping some source of bytes to serve as parser input.
- Companion:
- object
- Companion:
- class
Stateful, mutable abstraction for reading a stream of CBOR or JSON data from the given input
.
Stateful, mutable abstraction for reading a stream of CBOR or JSON data from the given input
.
Facilities for on-the-side logging of either encoding or decoding progress, which can be useful for debugging problems with the input or custom codec logic.
Facilities for on-the-side logging of either encoding or decoding progress, which can be useful for debugging problems with the input or custom codec logic.
Logging can be done either before or after the input validation step, depending on your needs. If unsure, go for after-validation logging, at least initially. (This is also the default.) For example, to log decoding progress to the console you can say:
Cbor.decode(inputBytes).withPrintLogging().to[MyType]
In order to enable an alternative Option codec, which
encodes None
to null
and Some
to an unwrapped value
you can import the members of this object with
In order to enable an alternative Option codec, which
encodes None
to null
and Some
to an unwrapped value
you can import the members of this object with
import io.bullet.borer.NullOptions._
Abstraction over serialization output.
Abstraction over serialization output.
The implementation can be either mutable or immutable.
- Companion:
- object
- Companion:
- class
The common interface of all types that consume CBOR data. (On the reading as well as the writing side)
The common interface of all types that consume CBOR data. (On the reading as well as the writing side)
- Companion:
- object
Abstraction for a "simple value" in CBOR-speak.
Abstraction for a "simple value" in CBOR-speak.
- Value parameters:
- value
the value's code
- Companion:
- object
Abstraction for a "tag" in CBOR-speak.
Abstraction for a "tag" in CBOR-speak.
- Value parameters:
- code
the tag's code
- Companion:
- object
Abstraction for the "undefined" value in CBOR-speak.
Abstraction for the "undefined" value in CBOR-speak.