类 Netty5DataBufferFactory

java.lang.Object
cn.taketoday.core.io.buffer.Netty5DataBufferFactory
所有已实现的接口:
DataBufferFactory

public class Netty5DataBufferFactory extends Object implements DataBufferFactory
Implementation of the DataBufferFactory interface based on a Netty 5 BufferAllocator.
从以下版本开始:
4.0
作者:
Violeta Georgieva, Arjen Poutsma
  • 构造器详细资料

    • Netty5DataBufferFactory

      public Netty5DataBufferFactory(io.netty5.buffer.api.BufferAllocator bufferAllocator)
      Create a new Netty5DataBufferFactory based on the given factory.
      参数:
      bufferAllocator - the factory to use
  • 方法详细资料

    • getBufferAllocator

      public io.netty5.buffer.api.BufferAllocator getBufferAllocator()
      Return the BufferAllocator used by this factory.
    • allocateBuffer

      @Deprecated public Netty5DataBuffer allocateBuffer()
      已过时。
      从接口复制的说明: DataBufferFactory
      Allocate 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

      public Netty5DataBuffer allocateBuffer(int initialCapacity)
      从接口复制的说明: DataBufferFactory
      Allocate 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

      public Netty5DataBuffer wrap(ByteBuffer byteBuffer)
      从接口复制的说明: DataBufferFactory
      Wrap the given ByteBuffer in a DataBuffer. Unlike allocating, wrapping does not use new memory.
      指定者:
      wrap 在接口中 DataBufferFactory
      参数:
      byteBuffer - the NIO byte buffer to wrap
      返回:
      the wrapped buffer
    • wrap

      public Netty5DataBuffer wrap(byte[] bytes)
      从接口复制的说明: DataBufferFactory
      Wrap the given byte array in a DataBuffer. Unlike allocating, wrapping does not use new memory.
      指定者:
      wrap 在接口中 DataBufferFactory
      参数:
      bytes - the byte array to wrap
      返回:
      the wrapped buffer
    • wrap

      public Netty5DataBuffer wrap(io.netty5.buffer.api.Buffer buffer)
      Wrap the given Netty Buffer in a Netty5DataBuffer.
      参数:
      buffer - the Netty buffer to wrap
      返回:
      the wrapped buffer
    • join

      public DataBuffer join(List<? extends DataBuffer> dataBuffers)
      Return a new 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 uses Netty's CompositeBuffer.

      指定者:
      join 在接口中 DataBufferFactory
      参数:
      dataBuffers - the data buffers to be composed
      返回:
      a buffer that is composed of the dataBuffers argument
    • isDirect

      public boolean isDirect()
      从接口复制的说明: DataBufferFactory
      Indicates whether this factory allocates direct buffers (i.e. non-heap, native memory).
      指定者:
      isDirect 在接口中 DataBufferFactory
      返回:
      true if this factory allocates direct buffers; false otherwise
    • toBuffer

      public static io.netty5.buffer.api.Buffer toBuffer(DataBuffer buffer)
      Return the given Netty DataBuffer as a Buffer.

      Returns the native buffer if buffer is a Netty5DataBuffer; returns BufferAllocator.copyOf(ByteBuffer) otherwise.

      参数:
      buffer - the DataBuffer to return a Buffer for
      返回:
      the netty Buffer
    • toString

      public String toString()
      覆盖:
      toString 在类中 Object