MultiplexedCodec

sealed

A trait that enables custom handling for encoding/decoding sequences.

class Object
trait Matchable
class Any

Value members

Concrete methods

final
def decode[F[_], A](dec: Decoder[A], deMux: BitVector => (BitVector, BitVector))(buffer: BitVector)(using cbf: Factory[A, F[A]]): Attempt[DecodeResult[F[A]]]

Repeatedly decodes values of type A and returns a collection of the specified type. Uses deMux repeatedly to obtain the stream of vectors to decode to a value of type A. Terminates when the next stream to decode is empty or upon first decoding error.

Repeatedly decodes values of type A and returns a collection of the specified type. Uses deMux repeatedly to obtain the stream of vectors to decode to a value of type A. Terminates when the next stream to decode is empty or upon first decoding error.

Note: For large sequences, it may be necessary to compact bits in deMux.

Value Params
buffer

input bits

deMux

returns (next, rest) tuples where next is input to dec yielding (value, remainder) and remainder ++ rest is the next input to deMux

dec

element decoder

final
def encode[A](enc: Encoder[A], mux: (BitVector, BitVector) => BitVector)(seq: Seq[A]): Attempt[BitVector]

Encodes all elements of the specified sequence and combines the results using mux, or returns the first encountered error.

Encodes all elements of the specified sequence and combines the results using mux, or returns the first encountered error.

Value Params
enc

element encoder

mux

multiplexing function

seq

elements to encode