List of utility methods to do ByteBuffer to Long Convert
long | readLong(ByteBuffer in, final int fitInBytes) Read long which was written to fitInBytes bytes and increment position. long tmpLength = 0; for (int i = 0; i < fitInBytes; ++i) { tmpLength |= (in.get() & 0xffl) << (8l * i); return tmpLength; |
void | writeVLong(ByteBuffer out, long i) Similar to WritableUtils#writeVLong(java.io.DataOutput,long) , but writes to a ByteBuffer . if (i >= -112 && i <= 127) { out.put((byte) i); return; int len = -112; if (i < 0) { i ^= -1L; len = -120; ... |