List of utility methods to do ByteBuffer to Int
int | readInt8(final ByteBuffer buffer) read Int int value = 0; for (int shVal = 0, octet = 0x80; (octet & 0x80) != 0; shVal += 7) { if (!buffer.hasRemaining()) { throw new EOFException(); octet = buffer.get(); value |= ((octet & 0x7F) << shVal); return value; |
boolean | readIntEquals(ByteBuffer buf, int i, int j) read Int Equals return buf.getInt(i) == buf.getInt(j);
|
int | readIntLE(ByteBuffer buf, int i) read Int LE assert buf.order() == ByteOrder.LITTLE_ENDIAN; return buf.getInt(i); |
int | readIntMSB(ByteBuffer logBuf) Read a int from the log in MSB order. int ret = (logBuf.get() & 0xFF) << 24; ret += (logBuf.get() & 0xFF) << 16; ret += (logBuf.get() & 0xFF) << 8; ret += (logBuf.get() & 0xFF) << 0; return ret; |
int | readIntoBuffer(SocketChannel channel, ByteBuffer buf, int sleepMsecs) read Into Buffer if (channel == null) { return -1; buf.clear(); int totRead = 0; while (totRead < buf.capacity()) { int nRead; try { ... |
int[] | readInts(final ByteBuffer bb, final int length) read Ints final int[] result = new int[length]; for (int index = 0; index < length; index++) { result[index] = bb.getInt(); return result; |
void | readInts4(final ByteBuffer buffer, final int[] array, final int count) read Ints readInts4(buffer, array, count, 0); |
int | readUnsigned(ByteBuffer in, int size) read Unsigned int integer = 0; int mask = 0xff; int shift = 0; for (int i = 0; i < size; i++) { integer |= (in.get() << shift) & mask; mask = mask << 8; shift += 8; return integer; |
int | readUnsignedByte(ByteBuffer buffer) read Unsigned Byte return convertByteToUnsigned(buffer.get());
|
long | readUnsignedInt(ByteBuffer buf) Unmarshall the next four bytes which hold an unsigned int into a long. long ret = (buf.get() & 0xFFL) << 0; ret += (buf.get() & 0xFFL) << 8; ret += (buf.get() & 0xFFL) << 16; ret += (buf.get() & 0xFFL) << 24; return ret; |