Java 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

ByteBufferallocaleByteBuffer(int capacity, boolean direct)
allocale Byte Buffer
return direct ? ByteBuffer.allocateDirect(capacity) : ByteBuffer.allocate(capacity);
ByteBufferallocateByteBuffer(boolean useDirectBuffer, int bufSize)
allocate Byte Buffer
if (useDirectBuffer) {
    return ByteBuffer.allocateDirect(bufSize);
} else {
    return ByteBuffer.allocate(bufSize);
ByteBufferallocateByteBuffer(final int bytes)
Allocates a new direct ByteBuffer with the specified size and returns it.
return ByteBuffer.allocateDirect(bytes);
ByteBufferallocateByteBuffer(int capacity)
Allocate a ByteBuffer .
return capacity >= MIN_DIRECT_BUFFER_SIZE ? ByteBuffer.allocateDirect(capacity)
        : ByteBuffer.allocate(capacity);
ByteBuffercreateByteBuffer(byte... data)
create Byte Buffer
ByteBuffer bb = createByteBuffer(data.length);
bb.put(data);
bb.flip();
return bb;
ByteBuffercreateByteBuffer(byte... values)
Constructs a direct native-ordered bytebuffer with the specified size.
ByteBuffer buff = createByteBuffer(values.length);
buff.flip();
return (buff);
ByteBuffercreateByteBuffer(byte[] data)
Create a ByteBuffer for the provided data using the default byte order ( DataTypeTestUtil#DEFAULT_BYTE_ORDER ).
return createByteBuffer(data, DEFAULT_BYTE_ORDER);
ByteBuffercreateByteBuffer(int byteCount)
create Byte Buffer
return ByteBuffer.allocate(byteCount).order(NATIVE_BYTE_ORDER);
ByteBuffercreateByteBuffer(int capacity)
create Byte Buffer
return ByteBuffer.allocate(capacity);
ByteBuffercreateByteBuffer(int capacity)
Allocates a direct native-ordered bytebuffer with the specified capacity.
return ByteBuffer.allocateDirect(capacity).order(ByteOrder.nativeOrder());