|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object cbr.service.PicsIterator
This class iterates over the picture entries
read from an input stream. Please note that this class does
not close the input stream. The owning class must do this
when the input stream is not longer required. For convenience this
class provides a close()
method which closes the
stream passed to the constructor. This close method is also
called upon finalization of instances of this class.
StoreDelegate
instances can be passed to
instances of this class in order to handle thumbnails.
Field Summary | |
private StoreDelegate |
delegate_
The StoreDelegate that is used
to paste back in entries into the entries. |
private ObjectInputStream |
in_
The stream from which the entries are read. |
private Object |
next_
The next object that will be returned upon a call to next() or null if
there are no more objects. |
Constructor Summary | |
PicsIterator()
Creates an instance that iterates the empty set of pictures. |
|
PicsIterator(InputStream in)
Creates an instance that reads from the given input stream. |
|
PicsIterator(InputStream in,
StoreDelegate delegate)
Creates an instance that uses the given StoreDelegate for pasting thumbnails back into the entries
which are returned. |
Method Summary | |
void |
close()
Closes the stream. |
protected void |
finalize()
|
boolean |
hasNext()
Fulfills the general contract of Iterator. |
Object |
next()
Fulfills the general contract of Iterator. |
private void |
read()
Reads in the next picture entry. |
void |
remove()
Not supported. |
Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private ObjectInputStream in_
private Object next_
next()
or null
if
there are no more objects.
private StoreDelegate delegate_
StoreDelegate
that is used
to paste back in entries into the entries.
Constructor Detail |
public PicsIterator()
public PicsIterator(InputStream in) throws IOException
Picture entries
are read
until an instance is encountered in the stream which
is not of class PictureEntry. The given stream is not
automatically closed.
This constructor is equivalent to calling
.
PicsIterator(in, null)
in
- The stream from which picture entries are read.
IOException
- if an I/O error occurs.public PicsIterator(InputStream in, StoreDelegate delegate) throws IOException
StoreDelegate
for pasting thumbnails back into the entries
which are returned.
If null
is passed as input stream then the
iterator iterates the equivalent of an empty set.
in
- The stream from which picture entries are read.delegate
- The StoreDelegate that handles thumbnails.
IOException
- if an I/O error occurs.Method Detail |
public boolean hasNext()
hasNext
in interface Iterator
true
iff there are more picture entries.public Object next() throws NoSuchElementException
next
in interface Iterator
NoSuchElementException
- iff there are no more
picture entries.public void remove()
remove
in interface Iterator
UnsupportedOperationException
- Always.private void read()
StoreDelegate
delegate was set then it is asked to paste the thumbnail
of that entry back into it.
public void close() throws IOException
IOException
- thrown by InputStream.protected void finalize()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |