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

voidwriteInt24(int v, ByteBuffer buffer)
write Int
writeByte(v, buffer);
writeByte(v >> 8, buffer);
writeByte(v >> 16, buffer);
intwriteInt4(final ByteBuffer bb, int value, int highValue, final boolean flush)
write Int
int nibbleL;
int nibbleH;
if (highValue > 0) {
    highValue &= 0x70; 
    nibbleL = value & 7;
    value >>>= 3;
    if (value != 0) {
        nibbleL |= 8;
...
voidwriteInt8(final ByteBuffer bb, int value)
write Int
int octet;
do {
    octet = value & 0x7F;
    value >>>= 7;
    if (value != 0) {
        octet |= 0x80;
    bb.put((byte) octet);
...
voidwriteIntArray(ByteBuffer buf, int[] arr)
write Int Array
final int size = arr.length;
buf.putInt(size);
for (int i = 0; i < size; i++) {
    buf.putInt(arr[i]);
voidwriteInts4(final ByteBuffer bb, final int... values)
write Ints
writeInts4(bb, values, 0, values.length);
voidwriteL(ByteBuffer to, ByteBuffer from, int count)
write L
if (from.hasArray()) {
    to.put(from.array(), from.arrayOffset() + from.position(), Math.min(from.remaining(), count));
} else {
    to.put(toArrayL(from, count));
intwriteLen(int len, ByteBuffer dest, int dOff)
write Len
while (len >= 0xFF) {
    dest.put(dOff++, (byte) 0xFF);
    len -= 0xFF;
dest.put(dOff++, (byte) len);
return dOff;
voidwriteLength(ByteBuffer buffer, long l)
write Length
if (l < 251) {
    buffer.put((byte) l);
} else if (l < 0x10000L) {
    buffer.put((byte) 252);
    writeUB2(buffer, (int) l);
} else if (l < 0x1000000L) {
    buffer.put((byte) 253);
    writeUB3(buffer, (int) l);
...
voidwriteLong(ByteBuffer buf, long value, int len)
write Long
for (int i = 0; i < len; i++) {
    buf.put((byte) ((value >>> (i << 3)) & 0xff));
voidwriteLong(ByteBuffer logBuf, long l)
Write a long into the log.
byte b = (byte) (l >>> 0);
logBuf.put(b);
b = (byte) (l >>> 8);
logBuf.put(b);
b = (byte) (l >>> 16);
logBuf.put(b);
b = (byte) (l >>> 24);
logBuf.put(b);
...