MultiplexedCodec

scodec.codecs.MultiplexedCodec
sealed trait MultiplexedCodec

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

Attributes

Source:
MultiplexedCodec.scala
Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Concise view

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.

Attributes

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

Source:
MultiplexedCodec.scala
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.

Attributes

enc

element encoder

mux

multiplexing function

seq

elements to encode

Source:
MultiplexedCodec.scala