The list of methods to do ByteBuffer Put are organized into topic(s).
InputStream
byteBufferToInputStream(final ByteBuffer byteBuffer) Produce an InputStream that is able to read from a ByteBuffer .
return new InputStream() {
final ByteBuffer buf = byteBuffer;
@Override
public int read() throws IOException {
if (!buf.hasRemaining()) {
return -1;
return buf.get() & 0xFF;
...
void
byteBufferToOutputStream(ByteBuffer in, OutputStream out) Reads the full contents of a ByteBuffer and writes them to an OutputStream.
final int BUF_SIZE = 8192;
if (in.hasArray()) {
out.write(in.array(), in.arrayOffset() + in.position(), in.remaining());
} else {
final byte[] b = new byte[Math.min(in.remaining(), BUF_SIZE)];
while (in.remaining() > 0) {
int bytesToRead = Math.min(in.remaining(), BUF_SIZE);
in.get(b, 0, bytesToRead);
...
byte[][]
getZeroTerminatedStringBytesArray(ByteBuffer inputBuffer) get Zero Terminated String Bytes Array
ArrayList<byte[]> array = new ArrayList<>();
while (inputBuffer.remaining() > 0) {
array.add(getZeroTerminatedStringBytes(inputBuffer));
return array.toArray(new byte[array.size()][]);