List of utility methods to do ByteBuffer Allocate
DoubleBuffer | allocateDoubles(final int howmany, final int SIZE) allocate Doubles return ByteBuffer.allocateDirect(howmany * SIZE).order(ByteOrder.nativeOrder()).asDoubleBuffer();
|
FloatBuffer | allocateFloats(final int howmany, final int SIZE) allocate Floats return ByteBuffer.allocateDirect(howmany * SIZE).order(ByteOrder.nativeOrder()).asFloatBuffer();
|
IntBuffer | allocateInt() Get an IntBuffer of size 4 with Little Endian Byte Order ByteBuffer status = ByteBuffer.allocateDirect(4);
status.order(ByteOrder.LITTLE_ENDIAN);
return status.asIntBuffer();
|
IntBuffer | allocateInts(final int[] intarray, final int SIZE) allocate Ints IntBuffer ib = ByteBuffer.allocateDirect(intarray.length * SIZE).order(ByteOrder.nativeOrder())
.asIntBuffer();
ib.put(intarray).flip();
return ib;
|
ByteBuffer | allocateNativeOrderDirectBuffer(int size) allocate Native Order Direct Buffer ByteBuffer buf = allocateBuffer(size, true);
buf.order(ByteOrder.nativeOrder());
return buf;
|
ByteBuffer | allocateTestBuffer(int capacity, boolean direct) allocate Test Buffer ByteBuffer bb; if (direct) { bb = ByteBuffer.allocateDirect(capacity); } else { bb = ByteBuffer.allocate(capacity); for (int i = 0; i < capacity; i++) { bb.put((byte) (i & 0xff)); ... |
void | fromBytes(byte[] data, boolean[] preAllocatedValues) from Bytes final ByteBuffer byteBuffer = ByteBuffer.wrap(data); for (int i = 0; i < preAllocatedValues.length; i++) { preAllocatedValues[i] = byteBuffer.get() == 1; |