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

ByteBuffernewByteBuffer(int numBytes)
new Byte Buffer
ByteBuffer buffer = ByteBuffer.allocateDirect(numBytes);
buffer.order(ByteOrder.nativeOrder());
return buffer;
ByteBuffernewByteBuffer(int paramInt)
new Byte Buffer
ByteBuffer localByteBuffer = ByteBuffer.allocateDirect(paramInt);
localByteBuffer.order(ByteOrder.nativeOrder());
return localByteBuffer;
ByteBuffersetupByteBuffer(ByteBuffer preBuffer, byte[] array)
setup Byte Buffer
if (preBuffer == null || preBuffer.capacity() < array.length) {
    preBuffer = createByteBuffer(array.length * 2);
} else {
    preBuffer.clear();
preBuffer.put(array);
preBuffer.position(0);
return preBuffer;
...
ByteBufferrenewBuffer(ByteBuffer buf)
renew Buffer
buf.position(0);
buf.limit(buf.capacity());
return buf;
ByteBufferallocateAudioBuffer(int size)
allocate Audio Buffer
ByteBuffer bb = ByteBuffer.allocateDirect(size);
bb.order(ByteOrder.LITTLE_ENDIAN);
return bb;
ByteBuffermakeByteBuffer(byte[] array)
make Byte Buffer
final int SIZE = Byte.SIZE / 8;
ByteBuffer byteBuffer = ByteBuffer.allocateDirect(array.length
        * SIZE);
byteBuffer.order(ByteOrder.nativeOrder());
byteBuffer.put(array);
byteBuffer.position(0);
return byteBuffer;
ByteBufferConvToByteBuffer(byte buf[])
Conv To Byte Buffer
ByteBuffer ReturnBuffer = ByteBuffer.allocateDirect(buf.length);
ReturnBuffer.order(ByteOrder.nativeOrder());
ReturnBuffer.put(buf);
ReturnBuffer.position(0);
return ReturnBuffer;
ByteBufferConvToByteBuffer(byte buf[])
Conv To Byte Buffer
ByteBuffer ReturnBuffer = ByteBuffer.allocateDirect(buf.length);
ReturnBuffer.order(ByteOrder.nativeOrder());
ReturnBuffer.put(buf);
ReturnBuffer.position(0);
return ReturnBuffer;
ByteBuffermakeByteBuffer(byte[] arr)
Make a direct NIO ByteBuffer from an array of floats
ByteBuffer bb = ByteBuffer.allocateDirect(arr.length);
bb.order(ByteOrder.nativeOrder());
bb.put(arr);
bb.position(0);
return bb;
ByteBuffermakeByteBuffer(byte[] arr)
Make a direct NIO ByteBuffer from an array of floats
ByteBuffer bb = ByteBuffer.allocateDirect(arr.length);
bb.order(ByteOrder.nativeOrder());
bb.put(arr);
bb.position(0);
return bb;