Class StringMediaReader

java.lang.Object
cool.scx.http.media.string.StringMediaReader
All Implemented Interfaces:
MediaReader<String>

public final class StringMediaReader extends Object implements MediaReader<String>
1, 如果未指定字符集则 使用 请求头中的字符集 如果请求头中的字符集为空则回退到 UTF_8 2, 如果指定字符集 忽略 请求头中的字符集
Version:
0.0.1
Author:
scx567888
  • Field Details

    • STRING_MEDIA_READER

      public static final StringMediaReader STRING_MEDIA_READER
      常用情况 特殊情况直接 new
  • Constructor Details

    • StringMediaReader

      public StringMediaReader(Charset charset)
  • Method Details

    • getContentTypeCharsetOrUTF8

      public static Charset getContentTypeCharsetOrUTF8(ScxHttpHeaders headers)
    • read

      public String read(cool.scx.io.ByteInput byteInput, ScxHttpHeaders headers) throws cool.scx.io.exception.ScxIOException, cool.scx.io.exception.AlreadyClosedException
      Description copied from interface: MediaReader
      读取内容
      Specified by:
      read in interface MediaReader<String>
      Parameters:
      byteInput - 输入流
      headers - 请求头 (在客户端状态下是 responseHeaders)
      Throws:
      cool.scx.io.exception.ScxIOException
      cool.scx.io.exception.AlreadyClosedException