public class ByteBufferUtils
extends java.lang.Object
Constructor and Description |
---|
ByteBufferUtils() |
Modifier and Type | Method and Description |
---|---|
static java.nio.ByteBuffer |
newReadableBuffer(int capacity) |
static java.nio.ByteBuffer |
newWriteableBuffer(int capacity) |
static int |
pour(java.nio.ByteBuffer source,
java.nio.ByteBuffer destination) |
static int |
pourAll(java.nio.ByteBuffer source,
TransportInput destinationTransportInput)
Pours the contents of
source into destinationTransportInput , calling
the TransportInput many times if necessary. |
static int |
pourArrayToBuffer(byte[] source,
int offset,
int sizeRequested,
java.nio.ByteBuffer destination)
Assumes
destination is ready to be written. |
static int |
pourBufferToArray(java.nio.ByteBuffer source,
byte[] destination,
int offset,
int sizeRequested)
Assumes
source is ready to be read. |
public static int pour(java.nio.ByteBuffer source, java.nio.ByteBuffer destination)
public static int pourArrayToBuffer(byte[] source, int offset, int sizeRequested, java.nio.ByteBuffer destination)
destination
is ready to be written.sizeRequested
if
destination
has insufficient remainingpublic static int pourAll(java.nio.ByteBuffer source, TransportInput destinationTransportInput) throws TransportException
source
into destinationTransportInput
, calling
the TransportInput many times if necessary. If the TransportInput returns a TransportResult
other than ok, data may remain in source.TransportException
public static int pourBufferToArray(java.nio.ByteBuffer source, byte[] destination, int offset, int sizeRequested)
source
is ready to be read.sizeRequested
if
source
has insufficient remainingpublic static java.nio.ByteBuffer newWriteableBuffer(int capacity)
public static java.nio.ByteBuffer newReadableBuffer(int capacity)