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

voidwriteVarLong(ByteBuffer buff, long x)
Write a variable size long.
while ((x & ~0x7f) != 0) {
    buff.put((byte) (0x80 | (x & 0x7f)));
    x >>>= 7;
buff.put((byte) x);
voidwriteVarLong(long n, ByteBuffer buff)
Writes a signed long with the "VarInt" format.
while ((n & 0xFFFF_FFFF_FFFF_FF80l) != 0) {
    byte data = (byte) (n | 0x80);
    buff.put(data);
    n >>>= 7;
buff.put((byte) n);
voidwriteVarLong(long value, ByteBuffer buf)
write Var Long
while ((value & 0xFFFFFFFFFFFFFF80L) != 0L) {
    buf.put((byte) ((value & 0x7F) | 0x80));
    value >>>= 7;
buf.put((byte) (value & 0x7F));
intwriteVInt(ByteBuffer bb, int i)
write V Int
return writeVLong(bb, i);
voidwriteWithLength(ByteBuffer buffer, byte[] src)
write With Length
int length = src.length;
if (length < 251) {
    buffer.put((byte) length);
} else if (length < 0x10000L) {
    buffer.put((byte) 252);
    writeUB2(buffer, length);
} else if (length < 0x1000000L) {
    buffer.put((byte) 253);
...
voidwriteXid(ByteBuffer logBuf, Xid xid)
write Xid
byte[] gid = xid.getGlobalTransactionId();
byte[] bqual = xid.getBranchQualifier();
writeInt(logBuf, xid.getFormatId());
if (gid == null) {
    logBuf.put((byte) -1);
} else {
    logBuf.put((byte) (gid.length));
    logBuf.put(gid);
...