scodec

Codec

trait Codec[A] extends AnyRef

Supports encoding a value of type A to a BitVector and decoding a BitVector to a value of A.

Not every value of A can be encoded to a bit vector and similarly, not every bit vector can be decoded to a value of type A. Hence, both encode and decode return either an error or the result. Furthermore, decode returns the remaining bits in the bit vector that it did not use in decoding.

Note: the decode function can be lifted to a state action via StateT[Error \/ ?, BitVector, A]. This type alias and associated constructor is provided by Codec.DecodingContext.

Linear Supertypes
AnyRef, Any
Known Subclasses
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. Codec
  2. AnyRef
  3. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Abstract Value Members

  1. abstract def decode(bits: BitVector): \/[Error, (BitVector, A)]

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

  2. abstract def encode(a: A): \/[Error, BitVector]

    Attempts to encode the specified value in to a bit vector.

Concrete Value Members

  1. final def !=(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  2. final def !=(arg0: Any): Boolean

    Definition Classes
    Any
  3. final def ##(): Int

    Definition Classes
    AnyRef → Any
  4. final def ==(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  5. final def ==(arg0: Any): Boolean

    Definition Classes
    Any
  6. final def >>~[B](f: (A) ⇒ Codec[B]): Codec[(A, B)]

    Operator alias for flatZip.

  7. final def as[B](implicit iso: Iso[B, A]): Codec[B]

    Returns a new codec that encodes/decodes a value of type B by using an iso between A and B.

  8. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  9. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws()
  10. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  11. def equals(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  12. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws()
  13. final def flatZip[B](f: (A) ⇒ Codec[B]): Codec[(A, B)]

    Returns a new codec that encodes/decodes a value of type (A, B) where the codec of B is dependent on A.

  14. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  15. def hashCode(): Int

    Definition Classes
    AnyRef → Any
  16. final def hlist: Codec[::[A, HNil]]

    Lifts this codec in to a codec of a singleton hlist, which allows easy binding to case classes of one argument.

  17. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  18. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  19. final def notify(): Unit

    Definition Classes
    AnyRef
  20. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  21. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  22. def toString(): String

    Definition Classes
    AnyRef → Any
  23. final def wait(): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws()
  24. final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws()
  25. final def wait(arg0: Long): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws()
  26. final def xmap[B](f: (A) ⇒ B, g: (B) ⇒ A): Codec[B]

    Maps to a codec of type B.

Inherited from AnyRef

Inherited from Any

Ungrouped