T
- The typeB
- The bodypublic interface ByteBufferFactory<T,B>
ByteBuffer
instances.Modifier and Type | Method and Description |
---|---|
ByteBuffer<B> |
buffer()
Allocate a
ByteBuffer . |
ByteBuffer<B> |
buffer(int initialCapacity)
Allocate a
ByteBuffer with the given initial capacity. |
ByteBuffer<B> |
buffer(int initialCapacity,
int maxCapacity)
Allocate a
ByteBuffer with the given initial capacity and the given maximal capacity. |
ByteBuffer<B> |
copiedBuffer(byte[] bytes)
Creates a new big-endian buffer whose content is a copy of the specified
array 's sub-region. |
ByteBuffer<B> |
copiedBuffer(ByteBuffer nioBuffer)
Creates a new big-endian buffer whose content is a copy of the specified NIO buffer.
|
T |
getNativeAllocator() |
ByteBuffer<B> |
wrap(B existing)
Wrap an existing buffer.
|
ByteBuffer<B> |
wrap(byte[] existing)
Wrap an existing buffer.
|
T getNativeAllocator()
ByteBuffer<B> buffer()
ByteBuffer
. If it is a direct or heap buffer depends on the actual implementation.ByteBuffer<B> buffer(int initialCapacity)
ByteBuffer
with the given initial capacity. If it is a direct or heap buffer depends on the
actual implementation.initialCapacity
- The initial capacityByteBuffer<B> buffer(int initialCapacity, int maxCapacity)
ByteBuffer
with the given initial capacity and the given maximal capacity. If it is a direct
or heap buffer depends on the actual implementation.initialCapacity
- The initial capacitymaxCapacity
- The maximum capacityByteBuffer<B> copiedBuffer(byte[] bytes)
array
's sub-region. The new
buffer's readerIndex
and writerIndex
are 0
and the specified length
respectively.bytes
- The bytesByteBuffer<B> copiedBuffer(ByteBuffer nioBuffer)
readerIndex
and writerIndex
are 0
and the specified length
respectively.nioBuffer
- The nioBufferByteBuffer<B> wrap(B existing)
existing
- The buffer to wrapByteBuffer
ByteBuffer<B> wrap(byte[] existing)
existing
- The bytes to wrapByteBuffer