fs2.data.cbor.low

Low-level representation and tools for CBOR data streams.

The low-level representation has two main goals:

  • it is a flat representation of the input stream, which allows for expressing collections that exceed the max size of Int.MaxValue
    • it doesn't interpret numbers, keeping their raw representation in memory.

This representation is useful when dealing with streams that may contain big collections or when it is not necessary to build an AST, as it is more efficient than the high-level one.

The data model follows closely the structure described in the RFC.

Attributes

Members list

Concise view

Type members

Classlikes

sealed trait CborItem

A low-level CBOR item. Items are emitted as soon as they are complete They can be used for reading/writing streamed CBOR data, including indefinite length arrays, maps, or strings.

A low-level CBOR item. Items are emitted as soon as they are complete They can be used for reading/writing streamed CBOR data, including indefinite length arrays, maps, or strings.

Attributes

Companion:
object
Source:
model.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object Break.type
object False.type
class Float16
class Float32
class Float64
object Null.type
object StartIndefiniteMap.type
class StartMap
class Tag
object True.type
object Undefined.type
object CborItem

Attributes

Companion:
trait
Source:
model.scala
Graph
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type

Value members

Concrete methods

def items[F[_]](implicit F: RaiseThrowable[F]): (F, Byte) => CborItem

Parses the input byte stream into a sequence of low-level CBOR items. This allows for parsing arbitrary long and deep CBOR data. No AST is built.

Parses the input byte stream into a sequence of low-level CBOR items. This allows for parsing arbitrary long and deep CBOR data. No AST is built.

Attributes

Source:
package.scala
def toBinary[F[_]](implicit F: RaiseThrowable[F]): (F, CborItem) => Byte

Transforms a stream of CBOR items into the binary representation.

Transforms a stream of CBOR items into the binary representation.

The resulting stream fails as soon as a problem is encounter.

Attributes

Source:
package.scala

Transforms a stream of CBOR items into the binary representation.

Transforms a stream of CBOR items into the binary representation.

This produces a valid byte stream if the input item stream is well-formed, otherwise result is uncertain and will eventually produce an invalid byte sequence.

Use this pipe if you are sure the stream is well-formed or if it does not matter to produce ill-formed streams.

Since no validation is performed, this pipe is more efficient and allows for better throughput.

Attributes

Source:
package.scala
def validate[F[_]](implicit F: RaiseThrowable[F]): (F, CborItem) => CborItem

Validates the stream of CBOR items, emitting them unchanged.

Validates the stream of CBOR items, emitting them unchanged.

The resulting stream is failed as soon as a problem is encountered.

Attributes

Source:
package.scala