Java Utililty Methods ByteBuffer Extract

List of utility methods to do ByteBuffer Extract

Description

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

Method

byte[]extract(ByteBuffer buf)
Properly extract the byte contents of a ByteBuffer
int len = buf.limit();
byte[] bytes = new byte[len];
buf.rewind();
buf.get(bytes);
return bytes;
byte[]extractBytes(ByteBuffer buf)
extract Bytes
byte[] ret = new byte[buf.limit()];
buf.get(ret);
return ret;
byte[]extractBytes(ByteBuffer buffer, int size)
extract Bytes
byte[] result = new byte[size];
for (int i = 0; i < size; i++) {
    result[i] = buffer.get();
return result;
byte[]extractBytes(ByteBuffer byteBuffer, byte startByte, byte endByte)
Return the bytes contained between the startByte and the endByte.
int curPosition = byteBuffer.position();
int curLimit = byteBuffer.limit();
if (byteBuffer.position() == 0) {
    throw new IllegalStateException("Invalid state");
byteBuffer.position(0);
byteBuffer.limit(curPosition);
int state = 0;
...
voidextractSingleHighCardDims(byte[] highCardArr, int index, int highCardinalityCount, ByteBuffer outBuffer)
This method will extract the single dimension from the complete high card dims byte[].+ The format of the byte [] will be, Totallength,CompleteStartOffsets,Dat
ByteBuffer buff = null;
short secIndex = 0;
short firstIndex = 0;
int length;
if (index == highCardinalityCount - 1) {
    buff = ByteBuffer.wrap(highCardArr, (index * 2) + 2, 2);
} else {
    buff = ByteBuffer.wrap(highCardArr, (index * 2) + 2, 4);
...