Class Netty5DataBufferFactory

java.lang.Object
org.springframework.core.io.buffer.Netty5DataBufferFactory
All Implemented Interfaces:
DataBufferFactory

@Deprecated(since="6.2.18", forRemoval=true) public class Netty5DataBufferFactory extends Object implements DataBufferFactory
Deprecated, for removal: This API element is subject to removal in a future version.
as of 6.2.18 with no replacement
Implementation of the DataBufferFactory interface based on a Netty 5 BufferAllocator.
Since:
6.0
Author:
Violeta Georgieva, Arjen Poutsma
  • Constructor Summary

    Constructors
    Constructor
    Description
    Netty5DataBufferFactory(io.netty5.buffer.BufferAllocator bufferAllocator)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Create a new Netty5DataBufferFactory based on the given factory.
  • Method Summary

    Modifier and Type
    Method
    Description
    Deprecated.
    allocateBuffer(int initialCapacity)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Allocate a data buffer of the given initial capacity.
    io.netty5.buffer.BufferAllocator
    Deprecated, for removal: This API element is subject to removal in a future version.
    Return the BufferAllocator used by this factory.
    boolean
    Deprecated, for removal: This API element is subject to removal in a future version.
    Indicates whether this factory allocates direct buffers (i.e.
    join(List<? extends DataBuffer> dataBuffers)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Return a new DataBuffer composed of the dataBuffers elements joined together.
    static io.netty5.buffer.Buffer
    Deprecated, for removal: This API element is subject to removal in a future version.
    Return the given Netty DataBuffer as a Buffer.
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    wrap(byte[] bytes)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Wrap the given byte array in a DataBuffer.
    wrap(io.netty5.buffer.Buffer buffer)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Wrap the given Netty Buffer in a Netty5DataBuffer.
    wrap(ByteBuffer byteBuffer)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Wrap the given ByteBuffer in a DataBuffer.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • Netty5DataBufferFactory

      public Netty5DataBufferFactory(io.netty5.buffer.BufferAllocator bufferAllocator)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Create a new Netty5DataBufferFactory based on the given factory.
      Parameters:
      bufferAllocator - the factory to use
  • Method Details

    • getBufferAllocator

      public io.netty5.buffer.BufferAllocator getBufferAllocator()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Return the BufferAllocator used by this factory.
    • allocateBuffer

      @Deprecated public Netty5DataBuffer allocateBuffer()
      Deprecated.
      Description copied from interface: 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.
      Specified by:
      allocateBuffer in interface DataBufferFactory
      Returns:
      the allocated buffer
    • allocateBuffer

      public Netty5DataBuffer allocateBuffer(int initialCapacity)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: 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.
      Specified by:
      allocateBuffer in interface DataBufferFactory
      Parameters:
      initialCapacity - the initial capacity of the buffer to allocate
      Returns:
      the allocated buffer
    • wrap

      public Netty5DataBuffer wrap(ByteBuffer byteBuffer)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: DataBufferFactory
      Wrap the given ByteBuffer in a DataBuffer. Unlike allocating, wrapping does not use new memory.
      Specified by:
      wrap in interface DataBufferFactory
      Parameters:
      byteBuffer - the NIO byte buffer to wrap
      Returns:
      the wrapped buffer
    • wrap

      public Netty5DataBuffer wrap(byte[] bytes)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: DataBufferFactory
      Wrap the given byte array in a DataBuffer. Unlike allocating, wrapping does not use new memory.
      Specified by:
      wrap in interface DataBufferFactory
      Parameters:
      bytes - the byte array to wrap
      Returns:
      the wrapped buffer
    • wrap

      public Netty5DataBuffer wrap(io.netty5.buffer.Buffer buffer)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Wrap the given Netty Buffer in a Netty5DataBuffer.
      Parameters:
      buffer - the Netty buffer to wrap
      Returns:
      the wrapped buffer
    • join

      public DataBuffer join(List<? extends DataBuffer> dataBuffers)
      Deprecated, for removal: This API element is subject to removal in a future version.
      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.

      Specified by:
      join in interface DataBufferFactory
      Parameters:
      dataBuffers - the data buffers to be composed
      Returns:
      a buffer that is composed of the dataBuffers argument
    • isDirect

      public boolean isDirect()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: DataBufferFactory
      Indicates whether this factory allocates direct buffers (i.e. non-heap, native memory).
      Specified by:
      isDirect in interface DataBufferFactory
      Returns:
      true if this factory allocates direct buffers; false otherwise
    • toBuffer

      public static io.netty5.buffer.Buffer toBuffer(DataBuffer buffer)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Return the given Netty DataBuffer as a Buffer.

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

      Parameters:
      buffer - the DataBuffer to return a Buffer for
      Returns:
      the netty Buffer
    • toString

      public String toString()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Overrides:
      toString in class Object