Packages

trait ByteReader extends AutoCloseable

A ByteReader provides a stateful API to extract bytes from an underlying buffer, which in most cases is a Buf. This conveniently allows codec implementations to decode frames, specifically when they need to decode and interpret the bytes as a numeric value.

Note

Unless otherwise stated, ByteReader implementations are not thread safe.

Linear Supertypes
AutoCloseable, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. ByteReader
  2. AutoCloseable
  3. AnyRef
  4. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Abstract Value Members

  1. abstract def close(): Unit
    Definition Classes
    AutoCloseable
    Annotations
    @throws( classOf[java.lang.Exception] )
  2. abstract def process(from: Int, until: Int, processor: Processor): Int

    Process the underlying buffer 1-byte at a time using the given Buf.Processor, starting at index from of the underlying buffer until index until of the underlying buffer.

    Process the underlying buffer 1-byte at a time using the given Buf.Processor, starting at index from of the underlying buffer until index until of the underlying buffer. Processing will halt if the processor returns false or after processing the final byte.

    from

    the starting index, inclusive. Must be non-negative.

    until

    the ending index, exclusive. Must be non-negative.

    returns

    -1 if the processor processed all bytes or the last processed index if the processor returns false. Will return -1 if from is greater than or equal to until or length of the underlying buffer. Will return -1 if until is greater than or equal to length of the underlying buffer.

    Note

    this does not advance the byte cursor.

  3. abstract def process(processor: Processor): Int

    Process the underlying buffer 1-byte at a time using the given Buf.Processor, starting at index 0 of the underlying buffer until index length of the underlying buffer.

    Process the underlying buffer 1-byte at a time using the given Buf.Processor, starting at index 0 of the underlying buffer until index length of the underlying buffer. Processing will halt if the processor returns false or after processing the final byte.

    returns

    -1 if the processor processed all bytes or the last processed index if the processor returns false.

    Note

    this does not advance the byte cursor.

  4. abstract def readAll(): Buf

    Like read, but extracts the remainder of bytes from cursor to the length.

    Like read, but extracts the remainder of bytes from cursor to the length. Note, this advances the cursor to the end of the buf.

  5. abstract def readByte(): Byte

    Extract 8 bits and interpret as a signed integer, advancing the byte cursor by 1.

  6. abstract def readBytes(n: Int): Buf

    Returns a new buffer representing a slice of this buffer, delimited by the indices [cursor, remaining).

    Returns a new buffer representing a slice of this buffer, delimited by the indices [cursor, remaining). Out of bounds indices are truncated. Negative indices are not accepted.

  7. abstract def readDoubleBE(): Double

    Extract 64 bits and interpret as a big endian floating point, advancing the byte cursor by 4.

  8. abstract def readDoubleLE(): Double

    Extract 64 bits and interpret as a little endian floating point, advancing the byte cursor by 4.

  9. abstract def readFloatBE(): Float

    Extract 32 bits and interpret as a big endian floating point, advancing the byte cursor by 4.

  10. abstract def readFloatLE(): Float

    Extract 32 bits and interpret as a little endian floating point, advancing the byte cursor by 4.

  11. abstract def readIntBE(): Int

    Extract 32 bits and interpret as a big endian integer, advancing the byte cursor by 4.

  12. abstract def readIntLE(): Int

    Extract 32 bits and interpret as a little endian int, advancing the byte cursor by 4.

  13. abstract def readLongBE(): Long

    Extract 64 bits and interpret as a big endian integer, advancing the byte cursor by 8.

  14. abstract def readLongLE(): Long

    Extract 64 bits and interpret as a little endian integer, advancing the byte cursor by 8.

  15. abstract def readMediumBE(): Int

    Extract 24 bits and interpret as a big endian integer, advancing the byte cursor by 3.

  16. abstract def readMediumLE(): Int

    Extract 24 bits and interpret as a little endian integer, advancing the byte cursor by 3.

  17. abstract def readShortBE(): Short

    Extract 16 bits and interpret as a big endian integer, advancing the byte cursor by 2.

  18. abstract def readShortLE(): Short

    Extract 16 bits and interpret as a little endian integer, advancing the byte cursor by 2.

  19. abstract def readString(bytes: Int, charset: Charset): String

    Extract exactly the specified number of bytes into a String using the specified Charset, advancing the byte cursor by bytes.

    Extract exactly the specified number of bytes into a String using the specified Charset, advancing the byte cursor by bytes.

    Exceptions thrown

    UnderflowException if there are < bytes bytes available

  20. abstract def readUnsignedByte(): Short

    Extract 8 bits and interpret as an unsigned integer, advancing the byte cursor by 1.

  21. abstract def readUnsignedIntBE(): Long

    Extract 32 bits and interpret as a big endian unsigned integer, advancing the byte cursor by 4.

  22. abstract def readUnsignedIntLE(): Long

    Extract 32 bits and interpret as a little endian unsigned integer, advancing the byte cursor by 4.

  23. abstract def readUnsignedLongBE(): BigInt

    Extract 64 bits and interpret as a big endian unsigned integer, advancing the byte cursor by 8.

  24. abstract def readUnsignedLongLE(): BigInt

    Extract 64 bits and interpret as a little endian unsigned integer, advancing the byte cursor by 8.

  25. abstract def readUnsignedMediumBE(): Int

    Extract 24 bits and interpret as a big endian unsigned integer, advancing the byte cursor by 3.

  26. abstract def readUnsignedMediumLE(): Int

    Extract 24 bits and interpret as a little endian unsigned integer, advancing the byte cursor by 3.

  27. abstract def readUnsignedShortBE(): Int

    Extract 16 bits and interpret as a big endian unsigned integer, advancing the byte cursor by 2.

  28. abstract def readUnsignedShortLE(): Int

    Extract 16 bits and interpret as a little endian unsigned integer, advancing the byte cursor by 2.

  29. abstract def remaining: Int

    The remainder of bytes that the reader is capable of reading.

  30. abstract def remainingUntil(byte: Byte): Int

    The remainder of bytes until the first occurrence of byte (exclusive).

    The remainder of bytes until the first occurrence of byte (exclusive). Returns -1 when byte is not found on the underlying resource.

    Note

    All util and finagle Buf implementations will not copy onto the heap, but for other implementations, it may trigger a copy.

  31. abstract def skip(n: Int): Unit

    Skip over the next n bytes.

    Skip over the next n bytes.

    Exceptions thrown

    UnderflowException if there are < n bytes available

Concrete Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def clone(): AnyRef
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @native() @throws( ... )
  6. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  7. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  8. def finalize(): Unit
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  9. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  10. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  11. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  12. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  13. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  14. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  15. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  16. def toString(): String
    Definition Classes
    AnyRef → Any
  17. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  18. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  19. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @throws( ... )

Inherited from AutoCloseable

Inherited from AnyRef

Inherited from Any

Ungrouped