Android Utililty Methods ByteBuffer Create

List of utility methods to do ByteBuffer Create

Description

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

Method

ByteBuffercreateDirectByteBuffer( 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;
ByteBuffercreateDirectByteBuffer(final int capacity)
create Direct Byte Buffer
return ByteBuffer.allocateDirect(capacity).order(
        ByteOrder.nativeOrder());
ByteBufferarr2ByteBuffer(byte[] arr)
arr Byte Buffer
ByteBuffer ibb = ByteBuffer.allocateDirect(arr.length << 2);
ibb.order(ByteOrder.nativeOrder());
ibb.put(arr);
ibb.position(0);
return ibb;
ByteBufferarr2ByteBuffer(byte[] arr)
arr Byte Buffer
ByteBuffer ibb = ByteBuffer.allocateDirect(arr.length);
ibb.order(ByteOrder.nativeOrder());
ibb.put(arr);
ibb.position(0);
return ibb;
ByteBufferarr2ByteBuffer(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;
ByteBufferarr2ByteBuffer(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;
ByteBufferlist2ByteBuffer(List arr)
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;
...
ByteBufferlist2ByteBuffer(List 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;
...
ByteBuffermakeByteBuffer(byte[] arr)
make Byte Buffer
ByteBuffer bb = ByteBuffer.allocateDirect(arr.length);
bb.order(ByteOrder.nativeOrder());
bb.put(arr);
bb.position(0);
return bb;
ByteBuffermakeByteBuffer(int size)
make Byte Buffer
ByteBuffer bb = ByteBuffer.allocateDirect(size);
bb.position(0);
return bb;