List of utility methods to do ByteBuffer to Int
int | readVarint(ByteBuffer buffer) Read an integer stored in variable-length format using zig-zag decoding from Google Protocol Buffers. int value = 0; int i = 0; int b; while (((b = buffer.get()) & 0x80) != 0) { value |= (b & 0x7f) << i; i += 7; if (i > 28) throw illegalVarintException(value); ... |
int | readVarInt(ByteBuffer buffer) read Var Int int i = 0; int j = 0; while (true) { int b0 = buffer.get(); i |= (b0 & 127) << j++ * 7; if (j > 5) { throw new IOException("VarInt too big"); if ((b0 & 128) != 128) { break; return i; |
int | readVarInt(ByteBuffer stream) read Var Int final byte b[] = new byte[1]; int count = 0; int result = 0; do { if (count == 5) { throw new IOException("stream corrupted"); stream.get(b); ... |
int | readVarIntRest(ByteBuffer buff, int b) read Var Int Rest int x = b & 0x7f; b = buff.get(); if (b >= 0) { return x | (b << 7); x |= (b & 0x7f) << 7; b = buff.get(); if (b >= 0) { ... |
int | toInt(ByteBuffer buffer) to Int return toByteBuffer(buffer, Integer.BYTES).getInt();
|
int | toInt(ByteBuffer buffer) Convert buffer to an integer. return toInt(buffer, buffer.position(), buffer.remaining());
|
int | toInt(ByteBuffer bytes) Convert a byte buffer to an integer. return bytes.getInt(bytes.position());
|
int | toInt(ByteBuffer value) to Int int result = 0; try { if (value != null) { int originPos = value.position(); result = value.getInt(); value.position(originPos); } catch (Exception ex) { ... |
int | toInt16BE(ByteBuffer buf, int[] out) to Int BE int samples = 0; while (buf.remaining() >= 2 && samples < out.length) { out[samples++] = (short) (((buf.get() & 0xff) << 8) | (buf.get() & 0xff)); return samples; |