List of utility methods to do ByteBuffer Create
ByteBuffer | createDirectByteBuffer( final int capacity, final ByteBuffer previous) create Direct Byte Buffer final ByteBuffer created = createDirectByteBuffer(capacity); if (null != previous) { previous.flip(); created.put(previous); return created; |
ByteBuffer | createDirectByteBuffer(final int capacity) create Direct Byte Buffer return ByteBuffer.allocateDirect(capacity).order(
ByteOrder.nativeOrder());
|
ByteBuffer | arr2ByteBuffer(byte[] arr) arr Byte Buffer ByteBuffer ibb = ByteBuffer.allocateDirect(arr.length << 2);
ibb.order(ByteOrder.nativeOrder());
ibb.put(arr);
ibb.position(0);
return ibb;
|
ByteBuffer | arr2ByteBuffer(byte[] arr) arr Byte Buffer ByteBuffer ibb = ByteBuffer.allocateDirect(arr.length);
ibb.order(ByteOrder.nativeOrder());
ibb.put(arr);
ibb.position(0);
return ibb;
|
ByteBuffer | arr2ByteBuffer(float[] arr) arr Byte Buffer ByteBuffer ibb = ByteBuffer.allocateDirect(arr.length << 2);
ibb.order(ByteOrder.nativeOrder());
FloatBuffer fbb = ibb.asFloatBuffer();
fbb.put(arr);
ibb.position(0);
return ibb;
|
ByteBuffer | arr2ByteBuffer(float[] arr) arr Byte Buffer ByteBuffer ibb = ByteBuffer.allocateDirect(arr.length * 4);
ibb.order(ByteOrder.nativeOrder());
FloatBuffer fbb = ibb.asFloatBuffer();
fbb.put(arr);
ibb.position(0);
return ibb;
|
ByteBuffer | list2ByteBuffer(List list Byte Buffer ByteBuffer ibb = ByteBuffer.allocateDirect(arr.size() * 4); ibb.order(ByteOrder.nativeOrder()); FloatBuffer fbb = ibb.asFloatBuffer(); for (float f : arr) { fbb.put(f); ibb.position(0); return ibb; ... |
ByteBuffer | list2ByteBuffer(List list Byte Buffer ByteBuffer ibb = ByteBuffer.allocateDirect(list.size() << 2); ibb.order(ByteOrder.nativeOrder()); FloatBuffer fbb = ibb.asFloatBuffer(); for (float f : list) { fbb.put(f); ibb.position(0); return ibb; ... |
ByteBuffer | makeByteBuffer(byte[] arr) make Byte Buffer ByteBuffer bb = ByteBuffer.allocateDirect(arr.length);
bb.order(ByteOrder.nativeOrder());
bb.put(arr);
bb.position(0);
return bb;
|
ByteBuffer | makeByteBuffer(int size) make Byte Buffer ByteBuffer bb = ByteBuffer.allocateDirect(size);
bb.position(0);
return bb;
|