messif.objects.util
Class AbstractStreamObjectIterator<E extends LocalAbstractObject>

java.lang.Object
  extended by messif.objects.util.AbstractObjectIterator<E>
      extended by messif.objects.util.AbstractStreamObjectIterator<E>
Type Parameters:
E - the class of objects provided by this stream iterator (must be descendant of LocalAbstractObject)
All Implemented Interfaces:
java.io.Closeable, java.util.Iterator<E>, ObjectProvider<E>
Direct Known Subclasses:
StreamGenericAbstractObjectIterator, StreamsMetaObjectMapIterator

public abstract class AbstractStreamObjectIterator<E extends LocalAbstractObject>
extends AbstractObjectIterator<E>
implements java.io.Closeable

This class represents an iterator on LocalAbstractObjects that are read from a file. The objects are instantiated one by one every time the next method is called. The file should be created using LocalAbstractObject.write(java.io.OutputStream) method.


Constructor Summary
AbstractStreamObjectIterator()
           
 
Method Summary
abstract  void reset()
          Reset the associated stream and restarts the iteration from beginning.
abstract  void setConstructorParameter(int index, java.lang.Object paramValue)
          Sets the value of this stream's object constructor argument.
 
Methods inherited from class messif.objects.util.AbstractObjectIterator
getCurrentObject, getCurrentObjectID, getMatchingObjects, getMatchingObjects, getMatchingObjects, getMatchingObjects, getObjectByAnyLocator, getObjectByData, getObjectByID, getObjectByLocator, getObjectByPosition, getRandomObject, getRandomObjects, nextObjectID, provideObjects
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.io.Closeable
close
 
Methods inherited from interface java.util.Iterator
hasNext, next, remove
 

Constructor Detail

AbstractStreamObjectIterator

public AbstractStreamObjectIterator()
Method Detail

setConstructorParameter

public abstract void setConstructorParameter(int index,
                                             java.lang.Object paramValue)
                                      throws java.lang.IndexOutOfBoundsException,
                                             java.lang.IllegalArgumentException,
                                             java.lang.InstantiationException
Sets the value of this stream's object constructor argument. This method can be used to change object passed to constructorArgs.

Parameters:
index - the parameter index to change (zero-based)
paramValue - the changed value to pass to the constructor
Throws:
java.lang.IllegalArgumentException - when the passed object is incompatible with the constructor's parameter
java.lang.IndexOutOfBoundsException - if the index parameter is out of bounds (zero parameter cannot be changed)
java.lang.InstantiationException - if the value passed is string that is not convertible to the constructor class

reset

public abstract void reset()
                    throws java.io.IOException
Reset the associated stream and restarts the iteration from beginning.

Throws:
java.io.IOException - if there was an I/O error re-opening the file