List of utility methods to do ByteBuffer to Int
int | getUnsignedByte(ByteBuffer bb) get Unsigned Byte return bb.get() & 0xFF;
|
int | getUnsignedByte(ByteBuffer buffer) Read an unsigned byte from a buffer int pos = buffer.position(); int rtn = getUnsignedByte(buffer, pos); buffer.position(pos + 1); return rtn; |
long | getUnsignedInt(ByteBuffer bb) Get a unsigned int from byte buffer an put the value in a long if (bb.remaining() >= 4) { return ((0x0FF & bb.get()) << 24) + ((0x0FF & bb.get()) << 16) + ((0x0FF & bb.get()) << 8) + (0x0FF & bb.get()); } else { throw new IndexOutOfBoundsException(); |
long | getUnsignedInt(ByteBuffer buffer) Read an unsigned integer from the current position in the buffer, incrementing the position by 4 bytes return buffer.getInt() & 0xffffffffL;
|
long | getUnsignedInt(ByteBuffer buffer) Read an unsigned integer from the current position in the buffer, incrementing the position by 4 bytes return buffer.getInt() & 0xffffffffL;
|
int | getUnsignedInt(ByteBuffer buffer) Reads a big-endian (31-bit) integer from the buffer and advances position. return (buffer.get() & 0x7F) << 24 | (buffer.get() & 0xFF) << 16 | (buffer.get() & 0xFF) << 8
| buffer.get() & 0xFF;
|
int | getUnsignedInt16LSBMSB(ByteBuffer byteBuffer) get Unsigned Int LSBMSB byte[] bytes = getBytes(byteBuffer, 2 * NUM_SHORT_BITS); int value = 0; for (int i = 0; i < NUM_SHORT_BITS; i++) { value += getUnsignedByte(bytes[i]) << (NUM_INTEGER_BITS * i); return value; |
BigInteger | getUnsignedLong(ByteBuffer buf) get Unsigned Long byte[] data = new byte[8]; buf.get(data); return new BigInteger(data); |
long | getUnsignedLong(final ByteBuffer src) Gets an unsigned long at the current position in the buffer. return (src.getLong() & LONG_FLAG_MASK_LONG);
|
int | getUnsignedShort(ByteBuffer bb) Returns an integer. return (bb.getShort(0) & 0xffff);
|