Class/Object

colossus.core

DataBuffer

Related Docs: object DataBuffer | package core

Permalink

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, DataReader, AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. DataBuffer
  2. Serializable
  3. Serializable
  4. Product
  5. Equals
  6. Encoder
  7. DataReader
  8. AnyRef
  9. Any
  1. Hide All
  2. Show all
Visibility
  1. Public
  2. All

Instance Constructors

  1. new DataBuffer(data: ByteBuffer)

    Permalink

Value Members

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

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

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

    Permalink
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  5. def bytes: ByteString

    Permalink
    Definition Classes
    Encoder
  6. def clone(): AnyRef

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

    Permalink
  8. def encode(out: DataOutBuffer): Unit

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

    Permalink
    Definition Classes
    AnyRef
  10. def finalize(): Unit

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

    Permalink
    Definition Classes
    AnyRef → Any
  12. def hasNext: Boolean

    Permalink

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

  13. def hasUnreadData: Boolean

    Permalink

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

  14. final def isInstanceOf[T0]: Boolean

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

    Permalink
    Definition Classes
    AnyRef
  16. def next(): Byte

    Permalink

    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

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

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

    Permalink
  20. def remaining: Int

    Permalink
  21. def size: Int

    Permalink

    Returns the total size of this DataBuffer

  22. def skip(n: Int): Unit

    Permalink

    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

  23. def skipAll(): Unit

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

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

    Permalink

    Get some bytes

    Get some bytes

    n

    how many bytes you want.

    returns

    an filled array of size min(n, remaining)

  26. def takeAll: Array[Byte]

    Permalink

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

  27. def takeCopy: DataBuffer

    Permalink

    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

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

    Permalink

    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

  29. def taken: Int

    Permalink

    Returns how many bytes have already been read from this DataBuffer

  30. final def wait(): Unit

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

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

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

    Permalink

    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 DataReader

Inherited from AnyRef

Inherited from Any

Ungrouped