Package edu.jas.util

Class CatReader

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable, java.lang.Readable

    public class CatReader
    extends java.io.Reader
    Reader to conncat two readers. Read from first reader until it is empty, then read from second reader.
    Author:
    Heinz Kredel
    • Field Summary

      • Fields inherited from class java.io.Reader

        lock
    • Constructor Summary

      Constructors 
      Constructor Description
      CatReader​(java.io.Reader f, java.io.Reader s)
      Constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()
      Close this Reader.
      int read​(char[] cbuf, int off, int len)
      Read char array.
      • Methods inherited from class java.io.Reader

        mark, markSupported, nullReader, read, read, read, ready, reset, skip, transferTo
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • CatReader

        public CatReader​(java.io.Reader f,
                         java.io.Reader s)
        Constructor.
        Parameters:
        f - first Reader.
        s - second Reader.
    • Method Detail

      • read

        public int read​(char[] cbuf,
                        int off,
                        int len)
                 throws java.io.IOException
        Read char array.
        Specified by:
        read in class java.io.Reader
        Parameters:
        cbuf - array.
        off - start offset.
        len - number of chars to read.
        Returns:
        number of chars read, or -1.
        Throws:
        java.io.IOException
      • close

        public void close()
                   throws java.io.IOException
        Close this Reader.
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Specified by:
        close in class java.io.Reader
        Throws:
        java.io.IOException