BufferTools

object BufferTools
class Object
trait Matchable
class Any

Value members

Concrete methods

def allocate(size: Int): ByteBuffer

Allocate a new ByteBuffer on the heap

Allocate a new ByteBuffer on the heap

Value Params
size

size of desired ByteBuffer

def bufferToString(buffer: ByteBuffer, charset: Charset): String

Get the String representation of the ByteBuffer

Get the String representation of the ByteBuffer

def checkEmpty(buffers: Array[ByteBuffer]): Boolean

Check the array of buffers to ensure they are all empty

Check the array of buffers to ensure they are all empty

Value Params
buffers

ByteBuffers to check for data

Returns

true if they are empty, false if there is data remaining

def checkEmpty(buffers: Iterable[ByteBuffer]): Boolean

Check the array of buffers to ensure they are all empty

Check the array of buffers to ensure they are all empty

Value Params
buffers

ByteBuffers to check for data

Returns

true if they are empty, false if there is data remaining

def concatBuffers(oldbuff: ByteBuffer, newbuff: ByteBuffer): ByteBuffer

Join the two buffers into a single ByteBuffer. This method is guaranteed to return a ByteBuffer, but it may be empty.

Join the two buffers into a single ByteBuffer. This method is guaranteed to return a ByteBuffer, but it may be empty.

def copyBuffer(b: ByteBuffer): ByteBuffer

Make a copy of the ByteBuffer, depleting the input buffer

Make a copy of the ByteBuffer, depleting the input buffer

def dropEmpty(buffers: Array[ByteBuffer]): Int

Replaces any empty buffers except for the last one with the emptyBuffer to allow GC of depleted ByteBuffers and returns the index of the first non-empty ByteBuffer, or the last index, whichever comes first.

Replaces any empty buffers except for the last one with the emptyBuffer to allow GC of depleted ByteBuffers and returns the index of the first non-empty ByteBuffer, or the last index, whichever comes first.

def joinBuffers(buffers: Seq[ByteBuffer]): ByteBuffer

Merge the ByteBuffers into a single buffer

Merge the ByteBuffers into a single buffer

def mkString(buffers: Seq[ByteBuffer], charset: Charset): String

Make a String from the collection of ByteBuffers

Make a String from the collection of ByteBuffers

def takeSlice(buffer: ByteBuffer, size: Int): ByteBuffer

Take a slice of bytes from the ByteBuffer, consuming the bytes.

Take a slice of bytes from the ByteBuffer, consuming the bytes.

Value Params
buffer

ByteBuffer to slice

size

number of bytes to slice. Must be less than or equal to the number of bytes remaining in buffer.

Returns

the resulting view

Concrete fields

val emptyBuffer: ByteBuffer

Cached empty ByteBuffer

Cached empty ByteBuffer

val emptyFutureBuffer: Future[ByteBuffer]

Cached Future containing and empty ByteBuffer

Cached Future containing and empty ByteBuffer