Package org.jfree.base.modules
Class AbstractModule.ReaderHelper
- java.lang.Object
-
- org.jfree.base.modules.AbstractModule.ReaderHelper
-
- Enclosing class:
- AbstractModule
private static class AbstractModule.ReaderHelper extends java.lang.Object
The reader helper provides a pushback interface for the reader to read and buffer complete lines.
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
ReaderHelper(java.io.BufferedReader reader)
Creates a new reader helper for the given buffered reader.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Closes the reader.boolean
hasNext()
Checks, whether the reader contains a next line.java.lang.String
next()
Returns the next line.void
pushBack(java.lang.String line)
Pushes the given line back into the buffer.protected java.lang.String
readLine()
Reads the next line skipping all comment lines.
-
-
-
Method Detail
-
hasNext
public boolean hasNext() throws java.io.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:
java.io.IOException
- if an error occures.
-
next
public java.lang.String next()
Returns the next line.- Returns:
- the next line.
-
pushBack
public void pushBack(java.lang.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 java.lang.String readLine() throws java.io.IOException
Reads the next line skipping all comment lines.- Returns:
- the next line, or null if no line can be read.
- Throws:
java.io.IOException
- if an IO error occures.
-
close
public void close() throws java.io.IOException
Closes the reader.- Throws:
java.io.IOException
- if an IOError occurs.
-
-