类 CharBufferDecoder

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

public final class CharBufferDecoder extends AbstractCharSequenceDecoder<CharBuffer>
Decode from a data buffer stream to a CharBuffer stream, either splitting or aggregating incoming data chunks to realign along newlines delimiters and produce a stream of char buffers. This is useful for streaming but is also necessary to ensure that multi-byte characters can be decoded correctly, avoiding split-character issues. The default delimiters used by default are \n and \r\n but that can be customized.
从以下版本开始:
4.0
作者:
Markus Heiden, Arjen Poutsma, Harry Yang
另请参阅:
  • 构造器详细资料

    • CharBufferDecoder

      public CharBufferDecoder(List<String> delimiters, boolean stripDelimiter, MimeType... mimeTypes)
  • 方法详细资料

    • 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<CharBuffer>
      覆盖:
      canDecode 在类中 AbstractDecoder<CharBuffer>
      参数:
      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
    • decodeInternal

      protected CharBuffer decodeInternal(DataBuffer dataBuffer, Charset charset)
      从类复制的说明: AbstractCharSequenceDecoder
      Template method that decodes the given data buffer into T, given the charset.
      指定者:
      decodeInternal 在类中 AbstractCharSequenceDecoder<CharBuffer>
    • textPlainOnly

      public static CharBufferDecoder textPlainOnly()
      Create a CharBufferDecoder for "text/plain".
    • textPlainOnly

      public static CharBufferDecoder textPlainOnly(List<String> delimiters, boolean stripDelimiter)
      Create a CharBufferDecoder for "text/plain".
      参数:
      delimiters - delimiter strings to use to split the input stream
      stripDelimiter - whether to remove delimiters from the resulting input strings
    • allMimeTypes

      public static CharBufferDecoder allMimeTypes()
      Create a CharBufferDecoder that supports all MIME types.
    • allMimeTypes

      public static CharBufferDecoder allMimeTypes(List<String> delimiters, boolean stripDelimiter)
      Create a CharBufferDecoder 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