com.hp.hpl.jena.util
Class NodeIteratorWrapper

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

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

A wrapper for NodeIterator 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: NodeIteratorWrapper.java,v 1.1 2001/09/24 17:02:35 ijd Exp $
Author:
Ian Dickinson, HP Labs (email)

Constructor Summary
NodeIteratorWrapper(NodeIterator nIterator)
          Construct an iterator to map a node iterator to a standard java iterator
 
Method Summary
 void close()
          Terminate the iteration and free up resources.
 boolean hasNext()
          Determine if there any more Nodes in the iteration.
 java.lang.Object next()
          Return the next Node 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

NodeIteratorWrapper

public NodeIteratorWrapper(NodeIterator nIterator)
Construct an iterator to map a node iterator to a standard java iterator
Parameters:
nIterator - The NodeIterator we want to wrap
Method Detail

hasNext

public boolean hasNext()
Determine if there any more Nodes 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 Node 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.