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.| Modifier and Type | Field and Description | 
|---|---|
| static int | DEFAULT_INITIAL_CAPACITYThe default capacity when none is specified. | 
| Constructor and Description | 
|---|
| DefaultDataBufferFactory()Creates a new  DefaultDataBufferFactorywith default settings. | 
| DefaultDataBufferFactory(boolean preferDirect)Creates a new  DefaultDataBufferFactory, indicating whether direct
 buffers should be created byallocateBuffer()andallocateBuffer(int). | 
| DefaultDataBufferFactory(boolean preferDirect,
                        int defaultInitialCapacity)Creates a new  DefaultDataBufferFactory, indicating whether direct
 buffers should be created byallocateBuffer()andallocateBuffer(int), and what the capacity is to be used forallocateBuffer(). | 
| Modifier and Type | Method and Description | 
|---|---|
| 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  DataBuffercomposed of thedataBufferselements joined together. | 
| String | toString() | 
| DefaultDataBuffer | wrap(byte[] bytes)Wrap the given  bytearray in aDataBuffer. | 
| DefaultDataBuffer | wrap(ByteBuffer byteBuffer)Wrap the given  ByteBufferin aDataBuffer. | 
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 in interface DataBufferFactorypublic DefaultDataBuffer allocateBuffer(int initialCapacity)
DataBufferFactoryallocateBuffer in interface DataBufferFactoryinitialCapacity - the initial capacity of the buffer to allocatepublic DefaultDataBuffer wrap(ByteBuffer byteBuffer)
DataBufferFactorywrap in interface DataBufferFactorybyteBuffer - the NIO byte buffer to wrappublic DefaultDataBuffer wrap(byte[] bytes)
DataBufferFactorywrap in interface 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 in interface DataBufferFactorydataBuffers - the data buffers to be composeddataBuffers argument