|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcbr.util.LineIterator
This iterator takes an input stream and iterates
through the lines read from it. Each line is
returned successively as a String on calls to the
method next
. In order
to iterate through a directory of pictures, make
a list of the pictures in that directory. This is
accomplished for instance by issuing the command
ls >ls.txt
in the picture folder.
Field Summary | |
private String |
next_
|
private LineNumberReader |
reader_
|
Constructor Summary | |
LineIterator(InputStream in)
Creates an instance that iterates the given directory. |
Method Summary | |
protected void |
finalize()
Free the reader if the iterator is not exhausted. |
boolean |
hasNext()
Fulfils the contract of Iterator . |
Object |
next()
Fulfils the contract of Iterator . |
void |
remove()
Callers have no business removing pictures. |
Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private LineNumberReader reader_
private String next_
Constructor Detail |
public LineIterator(InputStream in)
Method Detail |
public boolean hasNext()
Iterator
.
hasNext
in interface Iterator
true
if there are more
pictures.public Object next() throws NoSuchElementException
Iterator
.
next
in interface Iterator
NoSuchElementException
public void remove()
remove
in interface Iterator
UnsupportedOperationException
- always.protected void finalize()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |