Java Utililty Methods ByteBuffer Get

List of utility methods to do ByteBuffer Get

Description

The list of methods to do ByteBuffer Get are organized into topic(s).

Method

intgetSize(int size, ByteBuffer buffer)
get Size
switch (size) {
case 0:
    return 1;
case 1:
    return 2;
case 2:
    return 4;
case 3:
...
intgetSizePrefix(ByteBuffer bb)
Extract the size prefix from a `ByteBuffer`.
return bb.getInt(bb.position());
intgetSmallSmartInt(ByteBuffer buffer)
Gets a small smart integer from the buffer.
if ((buffer.get(buffer.position()) & 0xff) < 128) {
    return (buffer.get() & 0xff) - 1;
int shortValue = buffer.getShort() & 0xFFFF;
return shortValue - 32769;
intgetSmart(ByteBuffer buf)
get Smart
int peek = buf.get(buf.position()) & 0xFF;
if (peek < 128) {
    return buf.get() & 0xFF;
} else {
    return (buf.getShort() & 0xFFFF) - 32768;
intgetSmartOld(ByteBuffer in)
get Smart Old
int value = in.get() & 0xff;
if (value < 128)
    return value;
value = value << 8;
value += (in.get() & 0xff);
return value - 32768;
intgetSurrogateKey(byte[] data, ByteBuffer buffer)
Below method will be used to get the surrogate key
int lenght = 4 - data.length;
for (int i = 0; i < lenght; i++) {
    buffer.put((byte) 0);
buffer.put(data);
buffer.rewind();
int surrogate = buffer.getInt();
buffer.clear();
...
longgetTableUuid(ByteBuffer rowKey)
get Table Uuid
return rowKey.getLong(rowKey.position() + 1);
ByteBuffergetTempByteBuffer()
get Temp Byte Buffer
synchronized (_cacheByteBuffer) {
    if (!_cacheByteBufferInUse) {
        _cacheByteBufferInUse = true;
        return _cacheByteBuffer;
return ByteBuffer.allocate(BUFFER_LEN);
byte[]getTerminatedArray(ByteBuffer buf)
get Terminated Array
int start = buf.position();
while (buf.get() != 0) {
int end = buf.position();
byte[] bytes = new byte[end - start - 1]; 
buf.position(start);
buf.get(bytes);
buf.position(end); 
...
intgetTriByte(ByteBuffer buf)
Reads a 'tri-byte' from the specified buffer.
return ((buf.get() & 0xFF) << 16) | ((buf.get() & 0xFF) << 8) | (buf.get() & 0xFF);