org.openjena.atlas.iterator
Class IteratorResourceClosing<T>

java.lang.Object
  extended by org.openjena.atlas.iterator.IteratorResourceClosing<T>
All Implemented Interfaces:
Iterator<T>, Closeable

public class IteratorResourceClosing<T>
extends Object
implements Iterator<T>, Closeable

This iterator will automatically close a Closeable resource when the iterator is exhausted. Alternatively, the resource will be closed when close() is called. An AtlasException will be thrown if access is attempted after close() has been called.


Constructor Summary
IteratorResourceClosing(Iterator<T> iter, Closeable resource)
           
 
Method Summary
 void close()
           
 boolean hasNext()
           
 T next()
           
 void remove()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IteratorResourceClosing

public IteratorResourceClosing(Iterator<T> iter,
                               Closeable resource)
Method Detail

hasNext

public boolean hasNext()
Specified by:
hasNext in interface Iterator<T>

next

public T next()
Specified by:
next in interface Iterator<T>

remove

public void remove()
Specified by:
remove in interface Iterator<T>

close

public void close()
Specified by:
close in interface Closeable


Licenced under the Apache License, Version 2.0