public class DefaultDataBufferFactory extends Object implements DataBufferFactory
DataBufferFactory interface. Allows for
specification of the default initial capacity at construction time, as well
as whether heap-based or direct buffers are to be preferred.| 限定符和类型 | 字段和说明 |
|---|---|
static int |
DEFAULT_INITIAL_CAPACITY
The default capacity when none is specified.
|
| 构造器和说明 |
|---|
DefaultDataBufferFactory()
Creates a new
DefaultDataBufferFactory with default settings. |
DefaultDataBufferFactory(boolean preferDirect)
Creates a new
DefaultDataBufferFactory, indicating whether direct
buffers should be created by allocateBuffer() and
allocateBuffer(int). |
DefaultDataBufferFactory(boolean preferDirect,
int defaultInitialCapacity)
Creates a new
DefaultDataBufferFactory, indicating whether direct
buffers should be created by allocateBuffer() and
allocateBuffer(int), and what the capacity is to be used for
allocateBuffer(). |
| 限定符和类型 | 方法和说明 |
|---|---|
DefaultDataBuffer |
allocateBuffer()
Allocate a data buffer of a default initial capacity.
|
DefaultDataBuffer |
allocateBuffer(int initialCapacity)
Allocate a data buffer of the given initial capacity.
|
DefaultDataBuffer |
join(List<? extends DataBuffer> dataBuffers)
Return a new
DataBuffer composed of the dataBuffers elements joined together. |
String |
toString() |
DefaultDataBuffer |
wrap(byte[] bytes)
Wrap the given
byte array in a DataBuffer. |
DefaultDataBuffer |
wrap(ByteBuffer byteBuffer)
Wrap the given
ByteBuffer in a DataBuffer. |
public static final int DEFAULT_INITIAL_CAPACITY
public DefaultDataBufferFactory()
DefaultDataBufferFactory with default settings.public DefaultDataBufferFactory(boolean preferDirect)
DefaultDataBufferFactory, indicating whether direct
buffers should be created by allocateBuffer() and
allocateBuffer(int).preferDirect - true if direct buffers are to be preferred;
false otherwisepublic DefaultDataBufferFactory(boolean preferDirect,
int defaultInitialCapacity)
DefaultDataBufferFactory, indicating whether direct
buffers should be created by allocateBuffer() and
allocateBuffer(int), and what the capacity is to be used for
allocateBuffer().preferDirect - true if direct buffers are to be preferred;
false otherwisepublic DefaultDataBuffer allocateBuffer()
DataBufferFactoryallocateBuffer 在接口中 DataBufferFactorypublic DefaultDataBuffer allocateBuffer(int initialCapacity)
DataBufferFactoryallocateBuffer 在接口中 DataBufferFactoryinitialCapacity - the initial capacity of the buffer to allocatepublic DefaultDataBuffer wrap(ByteBuffer byteBuffer)
DataBufferFactorywrap 在接口中 DataBufferFactorybyteBuffer - the NIO byte buffer to wrappublic DefaultDataBuffer wrap(byte[] bytes)
DataBufferFactorywrap 在接口中 DataBufferFactorybytes - the byte array to wrappublic DefaultDataBuffer join(List<? extends DataBuffer> dataBuffers)
DataBuffer composed of the dataBuffers elements joined together.
Depending on the implementation, the returned buffer may be a single buffer containing all
data of the provided buffers, or it may be a true composite that contains references to the
buffers.
Note that the given data buffers do not have to be released, as they are released as part of the returned composite.
This implementation creates a single DefaultDataBuffer
to contain the data in dataBuffers.
join 在接口中 DataBufferFactorydataBuffers - the data buffers to be composeddataBuffers argumentCopyright © 2020. All rights reserved.