Java Utililty Methods ByteBuffer Write

List of utility methods to do ByteBuffer Write

Description

The list of methods to do ByteBuffer Write are organized into topic(s).

Method

voidwriteBooleanArray(boolean[] array, ByteBuffer out)
write Boolean Array
if (array == null) {
    writeVInt(-1, out);
    return;
writeVInt(array.length, out);
byte b_true = (byte) 1;
byte b_false = (byte) 0;
for (int i = 0; i < array.length; i++) {
...
voidwriteBuffer(ByteBuffer dest, ByteBuffer src)
write Buffer
int position = src.position();
dest.put(src);
src.position(position);
intwriteBuffer(ByteChannel channel, ByteBuffer buffer)
writing to channel buffer
int numberWritten = 0;
int totalWritten = numberWritten;
while (numberWritten >= 0 && buffer.hasRemaining()) {
    numberWritten = channel.write(buffer);
    totalWritten += numberWritten;
return totalWritten;
voidwriteBuffer(FileChannel fc, ByteBuffer buf, int startPos)
write Buffer
int pos = startPos;
while (buf.hasRemaining()) {
    pos += fc.write(buf, pos);
voidwriteBuffer(WritableByteChannel chan, ByteBuffer buf)
Write a buffer completely to the channel.
while (buf.hasRemaining()) {
    chan.write(buf);
voidwriteByte(ByteBuffer dest, int off, int i)
write Byte
dest.put(off, (byte) i);
voidwriteByteArray(byte[] array, ByteBuffer out)
write Byte Array
if (array == null) {
    writeVInt(-1, out);
    return;
writeVInt(array.length, out);
out.put(array);
voidwriteByteArray(byte[] data, ByteBuffer buffer)
write Byte Array
buffer.put(data);
voidwriteByteArray(ByteBuffer byteBuffer, byte[] bytes)
write Byte Array
byteBuffer.put(bytes);
voidwriteByteArray(ByteBuffer logBuf, byte[] b)
Write a byte array into the log.
writeInt(logBuf, b.length);
logBuf.put(b);