colossus.core

DataBuffer

case class DataBuffer(data: ByteBuffer) extends Encoder with Product with Serializable

A thin wrapper around a NIO ByteBuffer with data to read

DataBuffers are the primary way that data is read from and written to a connection. DataBuffers are mutable and not thread safe. They can only be read from once and cannot be reset.

Linear Supertypes
Serializable, Serializable, Product, Equals, Encoder, AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. DataBuffer
  2. Serializable
  3. Serializable
  4. Product
  5. Equals
  6. Encoder
  7. AnyRef
  8. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Instance Constructors

  1. new DataBuffer(data: ByteBuffer)

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. def asByteString: ByteString

  7. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  8. def bytes: ByteString

    Definition Classes
    Encoder
  9. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  10. val data: ByteBuffer

  11. def encode(out: DataOutBuffer): Unit

    Definition Classes
    DataBufferEncoder
  12. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  13. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  14. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  15. def hasNext: Boolean

    Returns true if this DataBuffer still has unread data, false otherwise

  16. def hasUnreadData: Boolean

    Returns true if this DataBuffer still has unread data, false otherwise

  17. final def isInstanceOf[T0]: Boolean

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

    Definition Classes
    AnyRef
  19. def next(): Byte

    Get the next byte, removing it from the buffer

    Get the next byte, removing it from the buffer

    WARNING : This method will throw an exception if no data is left. It is up to you to use hasUnreadData to figure out if you should call this. This is done to avoid unnecessary object allocation with using Option

    returns

    the next byte in the buffer

  20. final def notify(): Unit

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

    Definition Classes
    AnyRef
  22. def peek[T](f: (DataBuffer) ⇒ T): (T, Int)

  23. def remaining: Int

  24. def size: Int

    Returns the total size of this DataBuffer

  25. def skip(n: Int): Unit

    Skip over n bytes in the buffer.

    Skip over n bytes in the buffer.

    n

    the number of bytes to skip.

    Exceptions thrown
    IllegalArgumentException

    if n is larger than the number of remaining bytes

  26. def skipAll(): Unit

  27. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  28. def take(n: Int): Array[Byte]

    Get some bytes

    Get some bytes

    n

    how many bytes you want.

    returns

    an filled array of size min(n, remaining)

  29. def takeAll: Array[Byte]

    Returns an array containing all of the unread data in this Databuffer

  30. def takeCopy: DataBuffer

    Copy the unread data in this buffer to a new buffer

    Copy the unread data in this buffer to a new buffer

    Data will not be shared between the buffers. The position of this buffer will be completed

    returns

    a new DataBuffer containing only the unread data in this buffer

  31. def takeInto(buffer: Array[Byte], offset: Int, length: Int): Unit

    Directly copy data into a target byte array

    Directly copy data into a target byte array

    buffer

    the array to copy into

    offset

    the first index of buffer to start writing to

    length

    how many bytes to write

    Exceptions thrown
    ArrayOutOfBoundsException

    if target array is too small or buffer doesn't have sufficient bytes available

  32. def taken: Int

    Returns how many bytes have already been read from this DataBuffer

  33. final def wait(): Unit

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

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

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  36. def writeTo(channel: SocketChannel): Int

    Write the buffer into a SocketChannel

    Write the buffer into a SocketChannel

    The buffer's taken and remaining values will be updated to reflect how much data was written. Be aware that buffer's containing large amounts of data will probably not be written in one call

    channel

    the channel to write to

    returns

    how many bytes were written

Inherited from Serializable

Inherited from Serializable

Inherited from Product

Inherited from Equals

Inherited from Encoder

Inherited from AnyRef

Inherited from Any

Ungrouped