List of utility methods to do ByteBuffer to Long
long | getUInt(ByteBuffer buffer) get U Int assert (buffer.capacity() - buffer.position() >= 4); byte[] data = new byte[4]; data[3] = buffer.get(); data[2] = buffer.get(); data[1] = buffer.get(); data[0] = buffer.get(); return ((data[0] << 24) & 0xff000000l) | ((data[1] << 16) & 0x00ff0000l) | ((data[2] << 8) & 0x0000ff00l) | (data[3] & 0x000000ffl); ... |
long | getUInt(ByteBuffer buffer) get U Int return getUInt(buffer, buffer.capacity(), DEFAULT_BYTE_ORDER);
|
long | getUInt(java.nio.ByteBuffer buffer) get U Int return 0xFFFFFFFFL & (long) buffer.getInt(); |
int[] | getUInt16(ByteBuffer b, int n) get U Int int i[] = new int[n]; for (int k = 0; k < i.length; k++) { i[k] = getUInt16(b); return i; |
int | getUInt16(ByteBuffer buffer) get U Int int first = 0xff & buffer.get(); int second = 0xff & buffer.get(); if (buffer.order() == ByteOrder.LITTLE_ENDIAN) { return (first << 8 | second); } else { return (first | second << 8); |
int | getUInt16(ByteBuffer buffer) get U Int int first = 0xff & buffer.get(); int second = 0xff & buffer.get(); if (buffer.order() == ByteOrder.LITTLE_ENDIAN) { return (first << 8 | second); } else { return (first | second << 8); |
long | getUInt32(ByteBuffer b) get U Int return (b.getInt() & 0xFFFFFFFFL);
|
short[] | getUInt8(ByteBuffer b, int n) get U Int short s[] = new short[n]; for (int k = 0; k < s.length; k++) { s[k] = getUInt8(b); return s; |
long | getUInteger(ByteBuffer bb) get U Integer return bb.getInt() & 0xffffffffL;
|
long | readLong(ByteBuffer buf, int length) read Long if ((buf.position() + length) <= buf.limit() && length <= 8) { long r = 0; for (int i = 0; i < length; i++) { r |= (((long) buf.get() & 0xff) << (i << 3)); return r; return 0; ... |