Packages

final class StreamDecoder[+A] extends AnyRef

Supports binary decoding of a stream that emits elements as they are decoded.

The main purpose of using a StreamDecoder over a scodec.Decoder is mixing decoding with processing. For example, scodec.codecs.vector(decoderA): Decoder[Vector[A]] could be used to decode a bit stream but the decoded Vector[A] would not be emitted until the end of the bit stream. With StreamDecoder.many(decoderA): StreamDecoder[A], each decoded A value is emitted as soon as it is decoded.

The StreamDecoder companion has various constructors -- most importantly, once and many, that allow a Decoder[A] to be lifted to a StreamDecoder[A].

Given a StreamDecoder[A], a bit stream can be decoded via the decode method or by calling a variant of toPipe.

Self Type
StreamDecoder[A]
Source
StreamDecoder.scala
Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. StreamDecoder
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. def ++[A2 >: A](that: => StreamDecoder[A2]): StreamDecoder[A2]

    Creates a stream decoder that first decodes until this decoder finishes and then decodes using the supplied decoder.

    Creates a stream decoder that first decodes until this decoder finishes and then decodes using the supplied decoder.

    Note: this should not be used to write recursive decoders (e.g., def ints: StreamDecoder[A] = once(int32) ++ ints) if each incremental decoding step can fail with InsufficientBits. Otherwise, it decoding can get stuck in an infinite loop, where the remaining bits are fed to the recursive call.

  4. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  5. def apply[F[_]](s: Stream[F, BitVector])(implicit arg0: RaiseThrowable[F]): Pull[F, A, Option[Stream[F, BitVector]]]

    Returns a Pull[F, A, Option[Stream[F, BitVector]]] given a Stream[F, BitVector].

    Returns a Pull[F, A, Option[Stream[F, BitVector]]] given a Stream[F, BitVector]. The result of the returned pull is the remainder of the input stream that was not used in decoding.

  6. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  7. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native()
  8. def decode[F[_]](s: Stream[F, BitVector])(implicit arg0: RaiseThrowable[F]): Stream[F, A]

    Returns a Stream[F, A] given a Stream[F, BitVector].

  9. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  10. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  11. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable])
  12. def flatMap[B](f: (A) => StreamDecoder[B]): StreamDecoder[B]

    Creates a stream decoder that, upon decoding an A, applies it to the supplied function and decodes the next part of the input with the returned decoder.

    Creates a stream decoder that, upon decoding an A, applies it to the supplied function and decodes the next part of the input with the returned decoder. When that decoder finishes, the remainder of the input is returned to the original decoder for further decoding.

  13. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  14. def handleErrorWith[A2 >: A](f: (Throwable) => StreamDecoder[A2]): StreamDecoder[A2]
  15. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  16. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  17. def isolate(bits: Long): StreamDecoder[A]

    Alias for StreamDecoder.isolate(bits)(this).

  18. def map[B](f: (A) => B): StreamDecoder[B]

    Maps the supplied function over each output of this decoder.

  19. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  20. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  21. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  22. def strict: Decoder[Vector[A]]

    Converts this stream decoder to a Decoder[Vector[A]].

  23. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  24. def toPipe[F[_]](implicit arg0: RaiseThrowable[F]): Pipe[F, BitVector, A]

    Converts this decoder to a Pipe[F, BitVector, A].

  25. def toPipeByte[F[_]](implicit arg0: RaiseThrowable[F]): Pipe[F, Byte, A]

    Converts this decoder to a Pipe[F, Byte, A].

  26. def toString(): String
    Definition Classes
    AnyRef → Any
  27. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  28. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  29. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()

Inherited from AnyRef

Inherited from Any

Ungrouped