JBoss Remoting 3.1.0.Beta1

org.jboss.remoting3.stream
Interface ObjectSource<T>

Type Parameters:
T - the object type
All Superinterfaces:
Closeable

public interface ObjectSource<T>
extends Closeable

A streaming source for objects.


Method Summary
 void close()
          Close the stream.
 boolean hasNext()
          Indicate whether there are more objects to retrieve.
 T next()
          Get the next object in the stream.
 

Method Detail

hasNext

boolean hasNext()
                throws IOException
Indicate whether there are more objects to retrieve. If this method returns true, an object is guaranteed to be available. If this method returns false, the end of stream has been reached.

If this method returns true, it will continue to return true on every subsequent invocation until the next object is pulled using the next() method, or until the object source is closed. This method may block until the presence of the next object in the stream has been ascertained.

Returns:
true if there are more objects in this stream
Throws:
IOException

next

T next()
       throws NoSuchElementException,
              IOException
Get the next object in the stream. The hasNext() method should be called before this method is called to avoid receiving a NoSuchElementException.

Returns:
the next object
Throws:
NoSuchElementException - if no object is available
IOException - if an I/O error occurs

close

void close()
           throws IOException
Close the stream. No more objects may be read from this stream after it has been closed.

Specified by:
close in interface Closeable
Throws:
IOException - if an I/O error occurs

JBoss Remoting 3.1.0.Beta1

Copyright © 2010 JBoss, a division of Red Hat, Inc.