com.hp.hpl.jena.util
Class ResIteratorWrapper

java.lang.Object
  |
  +--com.hp.hpl.jena.util.ResIteratorWrapper
All Implemented Interfaces:
java.util.Iterator

public class ResIteratorWrapper
extends java.lang.Object
implements java.util.Iterator

A wrapper for ResIterator that turns it into a standard Java iterator. Clumsy name, and anyway the need for it may go away in a future version of Jena.

Version:
CVS info: $Id: ResIteratorWrapper.java,v 1.1 2001/09/24 17:02:36 ijd Exp $
Author:
Ian Dickinson, HP Labs (email)

Constructor Summary
ResIteratorWrapper(ResIterator nIterator)
          Construct an iterator to map a resource iterator to a standard java iterator
 
Method Summary
 void close()
          Terminate the iteration and free up resources.
 boolean hasNext()
          Determine if there any more resources in the iteration.
 java.lang.Object next()
          Return the next resource of the iteration.
 void remove()
          Unsupported Operation.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResIteratorWrapper

public ResIteratorWrapper(ResIterator nIterator)
Construct an iterator to map a resource iterator to a standard java iterator
Parameters:
nIterator - The ResIterator we want to wrap
Method Detail

hasNext

public boolean hasNext()
Determine if there any more resources in the iteration.
Specified by:
hasNext in interface java.util.Iterator
Returns:
true if and only if there are more Resources available from the iteration.

next

public java.lang.Object next()
                      throws java.util.NoSuchElementException
Return the next resource of the iteration.
Specified by:
next in interface java.util.Iterator
Returns:
The next Resource from the iteration.
Throws:
java.util.NoSuchElementException - if there are no more to be returned.

remove

public void remove()
            throws java.lang.UnsupportedOperationException
Unsupported Operation.
Specified by:
remove in interface java.util.Iterator
Throws:
{@link - java.lang.UnsupportedOperationException}

close

public void close()
           throws RDFException
Terminate the iteration and free up resources.

Some implementations, e.g. on relational databases, hold resources while the iterator still exists. These will normally be freed when the iteration completes. However, if an application wishes to ensure they are freed without completing the iteration, this method should be called.

Throws:
RDFException - Generic RDF exception.


Copyright © 2001 Hewlett-Packard. All Rights Reserved.