org.springframework.core.io.buffer

## 接口 DataBufferFactory

- 所有已知实现类:
    DefaultDataBufferFactory, NettyDataBufferFactory

      public interface DataBufferFactory

  A factory for `DataBuffers`, allowing for allocation and wrapping of data buffers.
  从以下版本开始:
    5.0
  作者:
    Arjen Poutsma
  另请参阅:
    `DataBuffer`

- - ### 方法概要

    所有方法 实例方法 抽象方法
    限定符和类型 | 方法和说明
    --- | ---
    `DataBuffer` | `allocateBuffer()` Allocate a data buffer of a default initial capacity.
    `DataBuffer` | `allocateBuffer(int initialCapacity)` Allocate a data buffer of the given initial capacity.
    `DataBuffer` | `join(List<? extends DataBuffer> dataBuffers)` Return a new `DataBuffer` composed of the `dataBuffers` elements joined together.
    `DataBuffer` | `wrap(byte[] bytes)` Wrap the given `byte` array in a `DataBuffer`.
    `DataBuffer` | `wrap(ByteBuffer byteBuffer)` Wrap the given `ByteBuffer` in a `DataBuffer`.

- - ### 方法详细资料

    - #### allocateBuffer

          DataBuffer allocateBuffer()

      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.
      返回:
        the allocated buffer

    - #### allocateBuffer

          DataBuffer allocateBuffer(int initialCapacity)

      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.
      参数:
        `initialCapacity` - the initial capacity of the buffer to allocate
      返回:
        the allocated buffer

    - #### wrap

          DataBuffer wrap(ByteBuffer byteBuffer)

      Wrap the given `ByteBuffer` in a `DataBuffer`. Unlike allocating, wrapping does not use new memory.
      参数:
        `byteBuffer` - the NIO byte buffer to wrap
      返回:
        the wrapped buffer

    - #### wrap

          DataBuffer wrap(byte[] bytes)

      Wrap the given `byte` array in a `DataBuffer`. Unlike allocating, wrapping does not use new memory.
      参数:
        `bytes` - the byte array to wrap
      返回:
        the wrapped buffer

    - #### join

          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.

      参数:
        `dataBuffers` - the data buffers to be composed
      返回:
        a buffer that is composed from the `dataBuffers` argument
      从以下版本开始:
        5.0.3