colossus.core

DataBuffer

case class DataBuffer(data: ByteBuffer) extends DataReader 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, DataReader, AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. DataBuffer
  2. Serializable
  3. Serializable
  4. Product
  5. Equals
  6. DataReader
  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. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  7. def clone(): AnyRef

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

  9. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  10. def finalize(): Unit

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

    Definition Classes
    AnyRef → Any
  12. def hasNext: Boolean

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

  13. def hasUnreadData: Boolean

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

  14. final def isInstanceOf[T0]: Boolean

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

    Definition Classes
    AnyRef
  16. 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

  17. final def notify(): Unit

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

    Definition Classes
    AnyRef
  19. def remaining: Int

  20. def size: Int

    Returns the total size of this DataBuffer

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

    Definition Classes
    AnyRef
  22. 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)

  23. def takeAll: Array[Byte]

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

  24. 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

  25. 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

  26. def taken: Int

    Returns how many bytes have already been read from this DataBuffer

  27. final def wait(): Unit

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

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

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  30. 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 DataReader

Inherited from AnyRef

Inherited from Any

Ungrouped