org.springframework.core.codec

## 类 AbstractDataBufferDecoder<T>

- java.lang.Object
- - org.springframework.core.codec.AbstractDecoder<T>
  - - org.springframework.core.codec.AbstractDataBufferDecoder<T>

- 所有已实现的接口:
    Decoder<T>
  直接已知子类:
    ByteArrayDecoder, ByteBufferDecoder, DataBufferDecoder, ResourceDecoder, StringDecoder

      public abstract class AbstractDataBufferDecoder<T>
      extends AbstractDecoder<T>

  Abstract base class for `Decoder` implementations that can decode a `DataBuffer` directly to the target element type.

  Sub-classes must implement `decodeDataBuffer(org.springframework.core.io.buffer.DataBuffer, org.springframework.core.ResolvableType, org.springframework.util.MimeType, java.util.Map<java.lang.String, java.lang.Object>)` to provide a way to transform a `DataBuffer` to the target data type. The default `decode(org.reactivestreams.Publisher<org.springframework.core.io.buffer.DataBuffer>, org.springframework.core.ResolvableType, org.springframework.util.MimeType, java.util.Map<java.lang.String, java.lang.Object>)` implementation transforms each individual data buffer while `decodeToMono(org.reactivestreams.Publisher<org.springframework.core.io.buffer.DataBuffer>, org.springframework.core.ResolvableType, org.springframework.util.MimeType, java.util.Map<java.lang.String, java.lang.Object>)` applies "reduce" and transforms the aggregated buffer.

  Sub-classes can override `decode(org.reactivestreams.Publisher<org.springframework.core.io.buffer.DataBuffer>, org.springframework.core.ResolvableType, org.springframework.util.MimeType, java.util.Map<java.lang.String, java.lang.Object>)` in order to split the input stream along different boundaries (e.g. on new line characters for `String`) or always reduce to a single data buffer (e.g. `Resource`).

  从以下版本开始:
    5.0
  作者:
    Rossen Stoyanchev

- - ### 构造器概要

    构造器
    限定符 | 构造器和说明
    --- | ---
    `protected` | `AbstractDataBufferDecoder(MimeType... supportedMimeTypes)`

  - ### 方法概要

    所有方法 实例方法 抽象方法 具体方法
    限定符和类型 | 方法和说明
    --- | ---
    `reactor.core.publisher.Flux<T>` | `decode(org.reactivestreams.Publisher<DataBuffer> inputStream, ResolvableType elementType, MimeType mimeType, Map<String,Object> hints)` Decode a `DataBuffer` input stream into a Flux of `T`.
    `protected abstract T` | `decodeDataBuffer(DataBuffer buffer, ResolvableType elementType, MimeType mimeType, Map<String,Object> hints)` How to decode a `DataBuffer` to the target element type.
    `reactor.core.publisher.Mono<T>` | `decodeToMono(org.reactivestreams.Publisher<DataBuffer> inputStream, ResolvableType elementType, MimeType mimeType, Map<String,Object> hints)` Decode a `DataBuffer` input stream into a Mono of `T`.

    - ### 从类继承的方法 org.springframework.core.codec.AbstractDecoder

      `canDecode, getDecodableMimeTypes`

    - ### 从类继承的方法 java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### 构造器详细资料

    - #### AbstractDataBufferDecoder

          protected AbstractDataBufferDecoder(MimeType... supportedMimeTypes)

  - ### 方法详细资料

    - #### decode

          public reactor.core.publisher.Flux<T> decode(org.reactivestreams.Publisher<DataBuffer> inputStream,
                                                       ResolvableType elementType,
                                                       @Nullable
                                                       MimeType mimeType,
                                                       @Nullable
                                                       Map<String,Object> hints)

      从接口复制的说明: `Decoder`
      Decode a `DataBuffer` input stream into a Flux of `T`.
      参数:
        `inputStream` - the `DataBuffer` input stream to decode
        `elementType` - the expected type of elements in the output stream; this type must have been previously passed to the `Decoder.canDecode(org.springframework.core.ResolvableType, org.springframework.util.MimeType)` method and it must have returned `true`.
        `mimeType` - the MIME type associated with the input stream (optional)
        `hints` - additional information about how to do encode
      返回:
        the output stream with decoded elements

    - #### decodeToMono

          public reactor.core.publisher.Mono<T> decodeToMono(org.reactivestreams.Publisher<DataBuffer> inputStream,
                                                             ResolvableType elementType,
                                                             @Nullable
                                                             MimeType mimeType,
                                                             @Nullable
                                                             Map<String,Object> hints)

      从接口复制的说明: `Decoder`
      Decode a `DataBuffer` input stream into a Mono of `T`.
      指定者:
        `decodeToMono` 在接口中 `Decoder<T>`
      覆盖:
        `decodeToMono` 在类中 `AbstractDecoder<T>`
      参数:
        `inputStream` - the `DataBuffer` input stream to decode
        `elementType` - the expected type of elements in the output stream; this type must have been previously passed to the `Decoder.canDecode(org.springframework.core.ResolvableType, org.springframework.util.MimeType)` method and it must have returned `true`.
        `mimeType` - the MIME type associated with the input stream (optional)
        `hints` - additional information about how to do encode
      返回:
        the output stream with the decoded element

    - #### decodeDataBuffer

          protected abstract T decodeDataBuffer(DataBuffer buffer,
                                                ResolvableType elementType,
                                                @Nullable
                                                MimeType mimeType,
                                                @Nullable
                                                Map<String,Object> hints)

      How to decode a `DataBuffer` to the target element type.