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

voidcopy(float[] src, ByteBuffer dst, int numFloats, int offset)
copy
dst.clear();
dst.limit(numFloats << 2);
for (int i = offset; i < offset + numFloats && i < src.length; i++) {
    dst.put(toByta(Float.floatToRawIntBits(src[i])));
dst.flip();
ByteBuffernewByteBuffer(int numBytes)
new Byte Buffer
ByteBuffer buffer = ByteBuffer.allocateDirect(numBytes);
buffer.order(ByteOrder.nativeOrder());
return buffer;
ByteBuffernewByteBuffer(int numBytes)
new Byte Buffer
ByteBuffer buffer = ByteBuffer.allocateDirect(numBytes);
buffer.order(ByteOrder.nativeOrder());
return buffer;
ByteBuffernewUnsafeByteBuffer(ByteBuffer buffer)
Registers the given ByteBuffer as an unsafe ByteBuffer.
allocatedUnsafe += buffer.capacity();
synchronized (unsafeBuffers) {
    unsafeBuffers.add(buffer);
return buffer;
ByteBuffernewUnsafeByteBuffer(int numBytes)
Allocates a new direct ByteBuffer from native heap memory using the native byte order.
ByteBuffer buffer = newDisposableByteBuffer(numBytes);
buffer.order(ByteOrder.nativeOrder());
allocatedUnsafe += numBytes;
synchronized (unsafeBuffers) {
    unsafeBuffers.add(buffer);
return buffer;
ByteBuffercreateByteBuffer(byte[] data)
Creates a ByteBuffer from the specified byte array.
ByteBuffer b = createByteBuffer(data.length);
b.put(data);
b.rewind();
return b;
ByteBuffercreateByteBuffer(int capacity)
Creates a ByteBuffer with the specified capacity.
ByteBuffer b = ByteBuffer.allocateDirect(capacity);
b.order(ByteOrder.nativeOrder());
return b;
ByteBuffercreateByteBuffer(int count)
create Byte Buffer
ByteBuffer data = ByteBuffer.allocateDirect(count * 4);
data.order(ByteOrder.nativeOrder());
return data;
ByteBuffercreateByteBuffer(int size)
create Byte Buffer
ByteBuffer bf = ByteBuffer.allocateDirect(size);
return bf.order(ByteOrder.nativeOrder());
ByteBuffercreateByteBuffer(int size)
create Byte Buffer
return ByteBuffer.allocateDirect(size).order(
        ByteOrder.nativeOrder());