Class RBufferedReader

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

    public class RBufferedReader
    extends java.io.BufferedReader
    A package-private utility extending java.io.BufferedReader. If a line read with readLine() is not useful for the calling code, it can be re-inserted in the stream. The same line will be returned again at the next readLine() call.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.util.ArrayList<java.lang.String> lines
      Re-inserted lines buffer.
      • Fields inherited from class java.io.Reader

        lock
    • Constructor Summary

      Constructors 
      Constructor Description
      RBufferedReader​(java.io.Reader in)
      It builds the reader.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String readLine()
      It returns the next line in the stream.
      void reinsertLine​(java.lang.String line)
      Reinserts a line in the stream.
      • Methods inherited from class java.io.BufferedReader

        close, lines, mark, markSupported, read, read, ready, reset, skip
      • Methods inherited from class java.io.Reader

        nullReader, read, read, transferTo
      • Methods inherited from class java.lang.Object

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

      • lines

        private final java.util.ArrayList<java.lang.String> lines
        Re-inserted lines buffer.
    • Constructor Detail

      • RBufferedReader

        public RBufferedReader​(java.io.Reader in)
        It builds the reader.
        Parameters:
        in - The underlying reader.
    • Method Detail

      • readLine

        public java.lang.String readLine()
                                  throws java.io.IOException
        It returns the next line in the stream.
        Overrides:
        readLine in class java.io.BufferedReader
        Throws:
        java.io.IOException - on IO errors
      • reinsertLine

        public void reinsertLine​(java.lang.String line)
        Reinserts a line in the stream. The line will be returned at the next readLine() call.
        Parameters:
        line - The line.