org.springframework.core.codec

## 类 StringDecoder

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

- 所有已实现的接口:
    Decoder<String>

      public class StringDecoder
      extends AbstractDataBufferDecoder<String>

  Decode from a data buffer stream to a `String` stream. Before decoding, this decoder realigns the incoming data buffers so that each buffer ends with a newline. This is to make sure that multibyte characters are decoded properly, and do not cross buffer boundaries. The default delimiters (`\n`, `\r\n`)can be customized.

  Partially inspired by Netty's `DelimiterBasedFrameDecoder`.

  从以下版本开始:
    5.0
  作者:
    Sebastien Deleuze, Brian Clozel, Arjen Poutsma, Mark Paluch
  另请参阅:
    `CharSequenceEncoder`

- - ### 字段概要

    字段
    限定符和类型 | 字段和说明
    --- | ---
    `static Charset` | `DEFAULT_CHARSET` The default charset to use, i.e.
    `static List<String>` | `DEFAULT_DELIMITERS` The default delimiter strings to use, i.e.

  - ### 方法概要

    所有方法 静态方法 实例方法 具体方法 已过时的方法
    限定符和类型 | 方法和说明
    --- | ---
    `static StringDecoder` | `allMimeTypes()` Create a `StringDecoder` that supports all MIME types.
    `static StringDecoder` | `allMimeTypes(boolean ignored)` 已过时。 as of Spring 5.0.4, in favor of `allMimeTypes()` or `allMimeTypes(List, boolean)`
    `static StringDecoder` | `allMimeTypes(List<String> delimiters, boolean stripDelimiter)` Create a `StringDecoder` that supports all MIME types.
    `boolean` | `canDecode(ResolvableType elementType, MimeType mimeType)` Whether the decoder supports the given target element type and the MIME type of the source stream.
    `reactor.core.publisher.Flux<String>` | `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 String` | `decodeDataBuffer(DataBuffer dataBuffer, ResolvableType elementType, MimeType mimeType, Map<String,Object> hints)` How to decode a `DataBuffer` to the target element type.
    `static StringDecoder` | `textPlainOnly()` Create a `StringDecoder` for `"text/plain"`.
    `static StringDecoder` | `textPlainOnly(boolean ignored)` 已过时。 as of Spring 5.0.4, in favor of `textPlainOnly()` or `textPlainOnly(List, boolean)`
    `static StringDecoder` | `textPlainOnly(List<String> delimiters, boolean stripDelimiter)` Create a `StringDecoder` for `"text/plain"`.

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

      `decodeToMono`

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

      `getDecodableMimeTypes`

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

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

- - ### 字段详细资料

    - #### DEFAULT_CHARSET

          public static final Charset DEFAULT_CHARSET

      The default charset to use, i.e. "UTF-8".

    - #### DEFAULT_DELIMITERS

          public static final List<String> DEFAULT_DELIMITERS

      The default delimiter strings to use, i.e. `\n` and `\r\n`.

  - ### 方法详细资料

    - #### canDecode

          public boolean canDecode(ResolvableType elementType,
                                   @Nullable
                                   MimeType mimeType)

      从接口复制的说明: `Decoder`
      Whether the decoder supports the given target element type and the MIME type of the source stream.
      指定者:
        `canDecode` 在接口中 `Decoder<String>`
      覆盖:
        `canDecode` 在类中 `AbstractDecoder<String>`
      参数:
        `elementType` - the target element type for the output stream
        `mimeType` - the mime type associated with the stream to decode (can be `null` if not specified)
      返回:
        `true` if supported, `false` otherwise

    - #### decode

          public reactor.core.publisher.Flux<String> 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`.
      指定者:
        `decode` 在接口中 `Decoder<String>`
      覆盖:
        `decode` 在类中 `AbstractDataBufferDecoder<String>`
      参数:
        `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

    - #### decodeDataBuffer

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

      从类复制的说明: `AbstractDataBufferDecoder`
      How to decode a `DataBuffer` to the target element type.
      指定者:
        `decodeDataBuffer` 在类中 `AbstractDataBufferDecoder<String>`

    - #### textPlainOnly

          @Deprecated
          public static StringDecoder textPlainOnly(boolean ignored)

      已过时。 as of Spring 5.0.4, in favor of `textPlainOnly()` or `textPlainOnly(List, boolean)`
      Create a `StringDecoder` for `"text/plain"`.
      参数:
        `ignored` - ignored

    - #### textPlainOnly

          public static StringDecoder textPlainOnly()

      Create a `StringDecoder` for `"text/plain"`.

    - #### textPlainOnly

          public static StringDecoder textPlainOnly(List<String> delimiters,
                                                    boolean stripDelimiter)

      Create a `StringDecoder` for `"text/plain"`.
      参数:
        `delimiters` - delimiter strings to use to split the input stream
        `stripDelimiter` - whether to remove delimiters from the resulting input strings

    - #### allMimeTypes

          @Deprecated
          public static StringDecoder allMimeTypes(boolean ignored)

      已过时。 as of Spring 5.0.4, in favor of `allMimeTypes()` or `allMimeTypes(List, boolean)`
      Create a `StringDecoder` that supports all MIME types.
      参数:
        `ignored` - ignored

    - #### allMimeTypes

          public static StringDecoder allMimeTypes()

      Create a `StringDecoder` that supports all MIME types.

    - #### allMimeTypes

          public static StringDecoder allMimeTypes(List<String> delimiters,
                                                   boolean stripDelimiter)

      Create a `StringDecoder` that supports all MIME types.
      参数:
        `delimiters` - delimiter strings to use to split the input stream
        `stripDelimiter` - whether to remove delimiters from the resulting input strings