类 Netty5DataBufferFactory
java.lang.Object
cn.taketoday.core.io.buffer.Netty5DataBufferFactory
- 所有已实现的接口:
DataBufferFactory
Implementation of the
DataBufferFactory interface based on a
Netty 5 BufferAllocator.- 从以下版本开始:
- 4.0
- 作者:
- Violeta Georgieva, Arjen Poutsma
-
构造器概要
构造器构造器说明Netty5DataBufferFactory(io.netty5.buffer.api.BufferAllocator bufferAllocator) Create a newNetty5DataBufferFactorybased on the given factory. -
方法概要
修饰符和类型方法说明已过时。allocateBuffer(int initialCapacity) Allocate a data buffer of the given initial capacity.io.netty5.buffer.api.BufferAllocatorReturn theBufferAllocatorused by this factory.booleanisDirect()Indicates whether this factory allocates direct buffers (i.e. non-heap, native memory).join(List<? extends DataBuffer> dataBuffers) Return a newDataBuffercomposed of thedataBufferselements joined together.static io.netty5.buffer.api.BuffertoBuffer(DataBuffer buffer) Return the given NettyDataBufferas aBuffer.toString()wrap(byte[] bytes) Wrap the givenbytearray in aDataBuffer.wrap(io.netty5.buffer.api.Buffer buffer) Wrap the given NettyBufferin aNetty5DataBuffer.wrap(ByteBuffer byteBuffer) Wrap the givenByteBufferin aDataBuffer.
-
构造器详细资料
-
Netty5DataBufferFactory
public Netty5DataBufferFactory(io.netty5.buffer.api.BufferAllocator bufferAllocator) Create a newNetty5DataBufferFactorybased on the given factory.- 参数:
bufferAllocator- the factory to use
-
-
方法详细资料
-
getBufferAllocator
public io.netty5.buffer.api.BufferAllocator getBufferAllocator()Return theBufferAllocatorused by this factory. -
allocateBuffer
已过时。从接口复制的说明:DataBufferFactoryAllocate a data buffer of a default initial capacity. Depending on the underlying implementation and its configuration, this will be heap-based or direct buffer.- 指定者:
allocateBuffer在接口中DataBufferFactory- 返回:
- the allocated buffer
-
allocateBuffer
从接口复制的说明:DataBufferFactoryAllocate a data buffer of the given initial capacity. Depending on the underlying implementation and its configuration, this will be heap-based or direct buffer.- 指定者:
allocateBuffer在接口中DataBufferFactory- 参数:
initialCapacity- the initial capacity of the buffer to allocate- 返回:
- the allocated buffer
-
wrap
从接口复制的说明:DataBufferFactory- 指定者:
wrap在接口中DataBufferFactory- 参数:
byteBuffer- the NIO byte buffer to wrap- 返回:
- the wrapped buffer
-
wrap
从接口复制的说明:DataBufferFactory- 指定者:
wrap在接口中DataBufferFactory- 参数:
bytes- the byte array to wrap- 返回:
- the wrapped buffer
-
wrap
Wrap the given NettyBufferin aNetty5DataBuffer.- 参数:
buffer- the Netty buffer to wrap- 返回:
- the wrapped buffer
-
join
Return a newDataBuffercomposed of thedataBufferselements 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 uses Netty's
CompositeBuffer.- 指定者:
join在接口中DataBufferFactory- 参数:
dataBuffers- the data buffers to be composed- 返回:
- a buffer that is composed of the
dataBuffersargument
-
isDirect
public boolean isDirect()从接口复制的说明:DataBufferFactoryIndicates whether this factory allocates direct buffers (i.e. non-heap, native memory).- 指定者:
isDirect在接口中DataBufferFactory- 返回:
trueif this factory allocates direct buffers;falseotherwise
-
toBuffer
Return the given NettyDataBufferas aBuffer.Returns the native buffer if
bufferis aNetty5DataBuffer; returnsBufferAllocator.copyOf(ByteBuffer)otherwise.- 参数:
buffer- theDataBufferto return aBufferfor- 返回:
- the netty
Buffer
-
toString
-