List of utility methods to do ByteBuffer to Int Array
int[] | getIntArray(ByteBuffer data, int offset, int length) get Int Array if (length == 0) { return new int[0]; data.position(offset); int[] intArray = new int[length / 2]; int index = 0; while (index < intArray.length) { intArray[index++] = data.getShort(); ... |
int | getIntBE(ByteBuffer b, int start, int end) get Int BE return (int) getLongBE(b, start, end); |
int | getIntBE(final ByteBuffer b, final int start, final int end) Computes a number whereby the 1st byte is the most significant and the last byte is the least significant. return (int) getLongBE(b, start, end); |
ByteBuffer | getIntByteBuffer(int id) get Int Byte Buffer ByteBuffer buffer = ByteBuffer.allocate(intSize);
buffer.putInt(id);
buffer.flip();
return buffer;
|
int | getIntegerFromBuffer(ByteBuffer buffer, int offset, int size) Gets integer from buffer int data = 0; try { if (size == 1) { data |= buffer.get(offset); } else if (size == 2) { data |= buffer.getShort(offset) & 0xFFFF; data = Short.reverseBytes((short) data); } else if (size == 4) { ... |
int | getIntFromBack(ByteBuffer bb) get Int From Back int val = bb.getInt(bb.limit() - 4); bb.limit(bb.limit() - 4); return val; |
Integer | getIntFromByteBuffer(ByteBuffer data) int from ByteBuffer return getIntFromBytes(data.array());
|
int | getIntWithChecksum(ByteBuffer buffer, Adler32 checksum) get Int With Checksum final int value = buffer.getInt(); checksum.update(value); return value; |
int[] | readIntArray(ByteBuffer bb) read Int Array int ints[] = null; int size = bb.getInt(); if (size >= 0) { ints = new int[size]; byte[] b = new byte[size * 4]; bb.get(b); int l = 0; for (int i = 0; i < b.length; i += 4) { ... |
int[] | readIntArray(ByteBuffer buf) No array length final int size = buf.getInt(); int[] arr = new int[size]; for (int i = 0; i < size; i++) { arr[i] = buf.getInt(); return arr; |