Returns true if this DataBuffer still has unread data, false otherwise
Returns true if this DataBuffer still has unread data, false otherwise
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
the next byte in the buffer
Returns the total size of this DataBuffer
Skip over n bytes in the buffer.
Skip over n bytes in the buffer.
the number of bytes to skip.
IllegalArgumentException
if n is larger than the number of remaining bytes
Get some bytes
Get some bytes
how many bytes you want.
an filled array of size min(n, remaining)
Returns an array containing all of the unread data in this 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
a new DataBuffer containing only the unread data in this buffer
Directly copy data into a target byte array
Directly copy data into a target byte array
the array to copy into
the first index of buffer to start writing to
how many bytes to write
ArrayOutOfBoundsException
if target array is too small or buffer doesn't have sufficient bytes available
Returns how many bytes have already been read from this DataBuffer
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
the channel to write to
how many bytes were written
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.