Package org.jfree.base.modules
Class AbstractModule.ReaderHelper
java.lang.Object
org.jfree.base.modules.AbstractModule.ReaderHelper
- Enclosing class:
AbstractModule
The reader helper provides a pushback interface for the reader to read and
buffer complete lines.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate String
The line buffer containing the last line read.private final BufferedReader
The reader from which to read the text. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
ReaderHelper
(BufferedReader reader) Creates a new reader helper for the given buffered reader. -
Method Summary
-
Field Details
-
buffer
The line buffer containing the last line read. -
reader
The reader from which to read the text.
-
-
Constructor Details
-
ReaderHelper
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
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
Returns the next line.- Returns:
- the next line.
-
pushBack
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
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
Closes the reader.- Throws:
IOException
- if an IOError occurs.
-