程序包 tools

类 UnicodeReader

  • 所有已实现的接口:
    java.io.Closeable, java.lang.AutoCloseable, java.lang.Readable

    public class UnicodeReader
    extends java.io.Reader
    Generic unicode textreader, which will use BOM mark to identify the encoding to be used. If BOM is not found then use a given default or system encoding.
    • 字段概要

      • 从类继承的字段 java.io.Reader

        lock
    • 构造器概要

      构造器 
      构造器 说明
      UnicodeReader​(java.io.InputStream in, java.lang.String defaultEnc)  
    • 方法概要

      所有方法 实例方法 具体方法 
      修饰符和类型 方法 说明
      void close()
      关闭
      java.lang.String getDefaultEncoding()  
      java.lang.String getEncoding()
      Get stream encoding or NULL if stream is uninitialized.
      protected void init()
      Read-ahead four bytes and check for BOM marks.
      int read​(char[] cbuf, int off, int len)
      读字符数组
      • 从类继承的方法 java.io.Reader

        mark, markSupported, nullReader, read, read, read, ready, reset, skip, transferTo
      • 从类继承的方法 java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 构造器详细资料

      • UnicodeReader

        public UnicodeReader​(java.io.InputStream in,
                             java.lang.String defaultEnc)
        参数:
        in - inputstream to be read
        defaultEnc - default encoding if stream does not have BOM marker. Give NULL to use system-level default.
    • 方法详细资料

      • getDefaultEncoding

        public java.lang.String getDefaultEncoding()
        返回:
        默认的字符集
      • getEncoding

        public java.lang.String getEncoding()
        Get stream encoding or NULL if stream is uninitialized. Call init() or read() method to initialize it.
        返回:
        text encoding
      • init

        protected void init()
                     throws java.io.IOException
        Read-ahead four bytes and check for BOM marks. Extra bytes are unread back to the stream, only BOM bytes are skipped.
        抛出:
        java.io.IOException - 异常
      • close

        public void close()
                   throws java.io.IOException
        关闭
        指定者:
        close 在接口中 java.lang.AutoCloseable
        指定者:
        close 在接口中 java.io.Closeable
        指定者:
        close 在类中 java.io.Reader
        抛出:
        java.io.IOException
      • read

        public int read​(char[] cbuf,
                        int off,
                        int len)
                 throws java.io.IOException
        读字符数组
        指定者:
        read 在类中 java.io.Reader
        参数:
        cbuf - 缓冲数组
        off - 开始偏移位置
        len - 计划读取的长度
        返回:
        实际读取的长度
        抛出:
        java.io.IOException