类 Readers


  • public class Readers
    extends java.lang.Object
    Util Methods for Reader
    • 构造器概要

      构造器 
      构造器 说明
      Readers()  
    • 方法概要

      所有方法 静态方法 具体方法 
      修饰符和类型 方法 说明
      static long discardAll​(java.io.Reader reader)
      Read and discard all data in reader till EOF.
      static java.util.stream.Stream<java.lang.String> lines​(java.io.Reader reader)
      Wrap Reader as a closable line stream.
      static java.lang.String readAll​(java.io.Reader reader)
      Read all data in Reader.
      static java.util.List<java.lang.String> toLines​(java.io.Reader reader)
      Read all from Reader to lines.
      static void transferTo​(java.io.Reader reader, java.io.Writer writer)
      Copy all data in Reader to Writer.
      static void transferTo​(java.io.Reader reader, java.lang.Appendable appendable)
      Copy all data in Reader to Appendable.
      • 从类继承的方法 java.lang.Object

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

      • Readers

        public Readers()
    • 方法详细资料

      • transferTo

        public static void transferTo​(java.io.Reader reader,
                                      java.io.Writer writer)
                               throws java.io.IOException
        Copy all data in Reader to Writer. Both Reader and Writer are leaved unclosed when copy finished, or Exception occurred.
        抛出:
        java.io.IOException
      • transferTo

        public static void transferTo​(java.io.Reader reader,
                                      java.lang.Appendable appendable)
                               throws java.io.IOException
        Copy all data in Reader to Appendable. Reader is leaved unclosed when copy finished, or Exception occurred.
        抛出:
        java.io.IOException
      • readAll

        public static java.lang.String readAll​(java.io.Reader reader)
                                        throws java.io.IOException
        Read all data in Reader. The Reader is leaved unclosed when read finished, or Exception occurred.
        返回:
        String read from the reader
        抛出:
        java.io.IOException
      • lines

        public static java.util.stream.Stream<java.lang.String> lines​(java.io.Reader reader)
        Wrap Reader as a closable line stream. You need to make sure the returned Stream is closed, close the stream will also close the reader.
        返回:
        the line stream
      • toLines

        public static java.util.List<java.lang.String> toLines​(java.io.Reader reader)
                                                        throws java.io.IOException
        Read all from Reader to lines. The Reader is leaved unclosed when copy finished, or Exception occurred.
        抛出:
        java.io.IOException
      • discardAll

        public static long discardAll​(java.io.Reader reader)
                               throws java.io.IOException
        Read and discard all data in reader till EOF. The Reader is left unclosed.
        返回:
        the char count read from reader.
        抛出:
        java.io.IOException