|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectscriptella.expression.LineIterator
public class LineIterator
An Iterator over the lines in a Reader, additionally properties substitution is performed.
This class change the contract of hasNext() method by
throwing RuntimeIOException on IOException.
Decorators should override format(String) method.
This class is not threadsafe.
PropertiesSubstitutor| Constructor Summary | |
|---|---|
LineIterator(java.io.Reader reader)
|
|
LineIterator(java.io.Reader reader,
PropertiesSubstitutor substitutor)
|
|
LineIterator(java.io.Reader reader,
PropertiesSubstitutor substitutor,
boolean trimLines)
Constructs iterator. |
|
| Method Summary | |
|---|---|
void |
close()
|
protected java.lang.String |
format(java.lang.String line)
Applies additional formatting to the line read. |
java.lang.String |
getLineAt(int n)
Returns specified line or null if EOF occured. |
boolean |
hasNext()
|
java.lang.String |
next()
Returns the next avalable line in a reader. |
void |
remove()
|
int |
skip(int n)
Skips N lines. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public LineIterator(java.io.Reader reader)
public LineIterator(java.io.Reader reader,
PropertiesSubstitutor substitutor)
public LineIterator(java.io.Reader reader,
PropertiesSubstitutor substitutor,
boolean trimLines)
reader - reader to iterate.substitutor - substitutor to use to expand properties or null to disable substitution.trimLines - true if the returned lines should be trimmed.| Method Detail |
|---|
public boolean hasNext()
throws RuntimeIOException
hasNext in interface java.util.Iterator<java.lang.String>next()
RuntimeIOException - if IO error occurs.protected java.lang.String format(java.lang.String line)
May be overriden by decorators.
line - line of text, nulls allowed.
public java.lang.String next()
throws RuntimeIOException,
java.util.NoSuchElementException
next in interface java.util.Iterator<java.lang.String>RuntimeIOException - if IO error occurs.
java.util.NoSuchElementException - if has no more elements.public int skip(int n)
n - number of lines to skip.
public java.lang.String getLineAt(int n)
n - line number relative to the current line in the input. n>=0
public void remove()
throws java.lang.UnsupportedOperationException
remove in interface java.util.Iterator<java.lang.String>java.lang.UnsupportedOperationException
public void close()
throws java.io.IOException
close in interface java.io.Closeablejava.io.IOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||