List of utility methods to do ByteBuffer to Int
long | readUnsignedInt(ByteBuffer buffer) Read an unsigned integer from the current position in the buffer, incrementing the position by 4 bytes return buffer.getInt() & 0xffffffffL;
|
long | readUnsignedInt(ByteBuffer buffer, int index) Read an unsigned integer from the given position without modifying the buffers position return buffer.getInt(index) & 0xffffffffL;
|
long | readUnsignedInt(ByteBuffer byteBuf) read Unsigned Int long val = byteBuf.getInt(); if (val < 0) val &= 0xFFFFFFFFL; return val; |
int | readUnsignedMedium(ByteBuffer buf) Gets a smart. int peek = buf.get(buf.position()) & 0xFF; if (peek < 128) { return buf.get() & 0xFF; } else { return (buf.getShort() & 0xFFFF) - 32768; |
int | readUnsignedShort(ByteBuffer bb) See the general contract of the readUnsignedShort method of DataInput .
int ch1 = bb.get() & 0xFF; int ch2 = bb.get() & 0xFF; return (ch1 << 8) + (ch2 << 0); |
int | readUnsignedShort(ByteBuffer buffer) read Unsigned Short return buffer.getShort() & 0xFFFF;
|
int | readUnsignedTriByte(ByteBuffer buffer) Reads an unsigned tri byte from the specified buffer. return (buffer.get() & 0xFF) << 16 | (buffer.get() & 0xFF) << 8 | buffer.get() & 0xFF;
|
int | readUnsignedVarint(ByteBuffer buffer) Read an unsigned integer. int val = 0; int bits = 0; while (true) { final int data = buffer.get(); val |= (data & 0x7F) << bits; if ((data & 0x80) == 0) { return val; bits += 7; if (bits > 35) { throw new IOException("Variable length quantity is too long for expected integer."); |
int | readVarInt(ByteBuffer buff) Read a variable size int. int b = buff.get(); if (b >= 0) { return b; return readVarIntRest(buff, b); |
int | readVarInt(ByteBuffer buff) Reads a VarInt. int shift = 0, i = 0; while (true) { byte b = (byte) buff.get(); i |= (b & 0x7F) << shift; shift += 7; if (b >= 0) { return i; |