Class AbstractModule.ReaderHelper

java.lang.Object
org.jfree.base.modules.AbstractModule.ReaderHelper
Enclosing class:
AbstractModule

private static class AbstractModule.ReaderHelper extends Object
The reader helper provides a pushback interface for the reader to read and buffer complete lines.
  • Field Details

    • buffer

      private String buffer
      The line buffer containing the last line read.
    • reader

      private final BufferedReader reader
      The reader from which to read the text.
  • Constructor Details

    • ReaderHelper

      protected ReaderHelper(BufferedReader reader)
      Creates a new reader helper for the given buffered reader.
      Parameters:
      reader - the buffered reader that is the source of the text.
  • Method Details

    • hasNext

      public boolean hasNext() throws IOException
      Checks, whether the reader contains a next line. Returns false if the end of the stream has been reached.
      Returns:
      true, if there is a next line to read, false otherwise.
      Throws:
      IOException - if an error occures.
    • next

      public String next()
      Returns the next line.
      Returns:
      the next line.
    • pushBack

      public void pushBack(String line)
      Pushes the given line back into the buffer. Only one line can be contained in the buffer at one time.
      Parameters:
      line - the line that should be pushed back into the buffer.
    • readLine

      protected String readLine() throws IOException
      Reads the next line skipping all comment lines.
      Returns:
      the next line, or null if no line can be read.
      Throws:
      IOException - if an IO error occures.
    • close

      public void close() throws IOException
      Closes the reader.
      Throws:
      IOException - if an IOError occurs.