|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.healthmarketscience.rmiio.RemoteIteratorClient<DataType>
public abstract class RemoteIteratorClient<DataType>
Base class for implementing the client side of a RemoteIterator. This
object is serialized and sent to the consumer of the data. The consumer
then pulls objects through the internal RemoteInputStream as needed.
Implementations of this class must implement the
initialize(InputStream)
and readNextObject()
methods. The
initialize() method is called once before the first call to
readNextObject() and gives the subclass access to the remote input stream.
The readNextObject() method should read an object from the underlying input
stream and return it. When all data is read, an EOFException should be
thrown indicating that the iterator is finished. A subclass may also
override closeIterator() to do any final cleanup (called when the
EOFException is thrown).
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface com.healthmarketscience.rmiio.CloseableIOIterator |
---|
CloseableIOIterator.Adapter<DataType> |
Field Summary |
---|
Fields inherited from interface com.healthmarketscience.rmiio.RemoteClient |
---|
DEFAULT_RETRY |
Constructor Summary | |
---|---|
protected |
RemoteIteratorClient(RemoteIteratorServer<DataType> server)
|
protected |
RemoteIteratorClient(RemoteIteratorServer<DataType> server,
RemoteStreamExporter exporter)
|
Method Summary | |
---|---|
void |
close()
Closes the iterator and releases the resources for the server object. |
protected void |
closeIterator()
Closes any resources held by this iterator. |
boolean |
hasNext()
Returns true iff the iteration has more elements. |
protected abstract void |
initialize(InputStream istream)
Initializes the subclass with a handle to the underlying remote input stream. |
DataType |
next()
Returns the next element in the iteration. |
protected abstract DataType |
readNextObject()
Reads the next object from the underlying input stream and returns it. |
void |
setRemoteRetry(RemoteRetry newRemoteRetry)
Sets the client side RemoteRetry policy to use for the underlying remote communication layer. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected RemoteIteratorClient(RemoteIteratorServer<DataType> server) throws IOException
IOException
protected RemoteIteratorClient(RemoteIteratorServer<DataType> server, RemoteStreamExporter exporter) throws IOException
IOException
Method Detail |
---|
public void setRemoteRetry(RemoteRetry newRemoteRetry)
RemoteClient
setRemoteRetry
in interface RemoteClient
newRemoteRetry
- the new RemoteRetry policy to use for remote
communication. null
causes the
RemoteClient.DEFAULT_RETRY
policy to be used.public boolean hasNext() throws IOException
IOIterator
true
iff the iteration has more elements.
hasNext
in interface IOIterator<DataType>
IOException
public DataType next() throws IOException
IOIterator
next
in interface IOIterator<DataType>
IOException
public void close() throws IOException
RemoteIterator
close
in interface RemoteIterator<DataType>
close
in interface Closeable
IOException
protected void closeIterator() throws IOException
IOException
protected abstract void initialize(InputStream istream) throws IOException
IOException
protected abstract DataType readNextObject() throws IOException
IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |