|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.healthmarketscience.rmiio.AbstractCloseableIOIterator<String> com.healthmarketscience.rmiio.LineIterator
public class LineIterator
CloseableIOIterator that reads lines from a BufferedReader, optionally trimming whitespace and/or skipping blank lines.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface com.healthmarketscience.rmiio.CloseableIOIterator |
---|
CloseableIOIterator.Adapter<DataType> |
Constructor Summary | |
---|---|
LineIterator(BufferedReader reader,
boolean trimWhitespace,
boolean skipBlankLines)
Creates a new LineIterator instance that will
read lines from the given BufferedReader and return them from
calls to next(). |
Method Summary | |
---|---|
protected void |
closeImpl()
Does the actual closing of the local resources. |
boolean |
hasNext()
Returns true iff the iteration has more elements. |
protected String |
nextImpl()
Does the actual work of the AbstractCloseableIOIterator.next() method. |
Methods inherited from class com.healthmarketscience.rmiio.AbstractCloseableIOIterator |
---|
close, next |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public LineIterator(BufferedReader reader, boolean trimWhitespace, boolean skipBlankLines) throws IOException
LineIterator
instance that will
read lines from the given BufferedReader
and return them from
calls to next().
reader
- the source of lines for this iteratortrimWhitespace
- if true, leading and trailing whitespace will be
trimmed from each lineskipBlankLines
- if true, empty lines will be skipped
IOException
Method Detail |
---|
public boolean hasNext() throws IOException
IOIterator
true
iff the iteration has more elements.
IOException
protected String nextImpl() throws IOException
AbstractCloseableIOIterator
AbstractCloseableIOIterator.next()
method. Will only be called if
IOIterator.hasNext()
is currently returning true
.
nextImpl
in class AbstractCloseableIOIterator<String>
IOException
protected void closeImpl()
AbstractCloseableIOIterator
AbstractCloseableIOIterator.close()
method regardless of how many times that
method is invoked.
Note, this method does not throw IOException
because it can be
called in a variety of different scenarios and throwing an IOException
would be useless in many of them (and often, failure to close is merely a
nuisance, not a cause for failure).
closeImpl
in class AbstractCloseableIOIterator<String>
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |