Decoder

scodec.Decoder
See theDecoder companion object
trait Decoder[+A]

Supports decoding a value of type A from a BitVector.

Attributes

Companion
object
Source
Decoder.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes
trait Codec[A]
class DiscriminatorCodec[A, B]
Self type
Decoder[A]

Members list

Value members

Abstract methods

Attempts to decode a value of type A from the specified bit vector.

Attempts to decode a value of type A from the specified bit vector.

Value parameters

bits

bits to decode

Attributes

Returns

error if value could not be decoded or the remaining bits and the decoded value

Source
Decoder.scala

Concrete methods

def as[B](using iso: Iso[A, B]): Decoder[B]
Extension method from Decoder

Attributes

Source
Decoder.scala
def asDecoder: Decoder[A]

Gets this as a Decoder.

Gets this as a Decoder.

Attributes

Source
Decoder.scala
def collect[F[_], A2 >: A](buffer: BitVector, limit: Option[Int])(using factory: Factory[A2, F[A2]]): Attempt[DecodeResult[F[A2]]]

Repeatedly decodes values of type A from the specified vector and returns a collection of the specified type. Terminates when no more bits are available in the vector or when limit is defined and that many records have been decoded. Exits upon first decoding error.

Repeatedly decodes values of type A from the specified vector and returns a collection of the specified type. Terminates when no more bits are available in the vector or when limit is defined and that many records have been decoded. Exits upon first decoding error.

Attributes

Source
Decoder.scala
def complete: Decoder[A]

Converts this decoder to a new decoder that fails decoding if there are remaining bits.

Converts this decoder to a new decoder that fails decoding if there are remaining bits.

Attributes

Source
Decoder.scala
final def decodeAll[B](f: A => B)(zero: B, append: (B, B) => B)(buffer: BitVector): (Option[Err], B)

Repeatedly decodes values of type A from the specified vector, converts each value to a B and appends it to an accumulator of type B using the supplied zero value and append function. Terminates when no more bits are available in the vector. Exits upon first decoding error.

Repeatedly decodes values of type A from the specified vector, converts each value to a B and appends it to an accumulator of type B using the supplied zero value and append function. Terminates when no more bits are available in the vector. Exits upon first decoding error.

Attributes

Returns

tuple consisting of the terminating error if any and the accumulated value

Source
Decoder.scala
def decodeOnly[AA >: A]: Codec[AA]

Converts this to a codec that fails encoding with an error.

Converts this to a codec that fails encoding with an error.

Attributes

Source
Decoder.scala
final def decodeValue(bits: BitVector): Attempt[A]

Attempts to decode a value of type A from the specified bit vector and discards the remaining bits.

Attempts to decode a value of type A from the specified bit vector and discards the remaining bits.

Value parameters

bits

bits to decode

Attributes

Returns

error if value could not be decoded or the decoded value

Source
Decoder.scala
def emap[B](f: A => Attempt[B]): Decoder[B]

Converts this decoder to a Decoder[B] using the supplied A => Attempt[B].

Converts this decoder to a Decoder[B] using the supplied A => Attempt[B].

Attributes

Source
Decoder.scala
def flatMap[B](f: A => Decoder[B]): Decoder[B]

Converts this decoder to a Decoder[B] using the supplied A => Decoder[B].

Converts this decoder to a Decoder[B] using the supplied A => Decoder[B].

Attributes

Source
Decoder.scala
def map[B](f: A => B): Decoder[B]

Converts this decoder to a Decoder[B] using the supplied A => B.

Converts this decoder to a Decoder[B] using the supplied A => B.

Attributes

Source
Decoder.scala