com.bretth.osmosis.core.store
Class IteratorReleasableIterator<T>

java.lang.Object
  extended by com.bretth.osmosis.core.store.IteratorReleasableIterator<T>
Type Parameters:
T - The data type to be iterated.
All Implemented Interfaces:
Releasable, ReleasableIterator<T>, java.util.Iterator<T>

public class IteratorReleasableIterator<T>
extends java.lang.Object
implements ReleasableIterator<T>

A releasable iterator implementation for reading data from an underlying non-releasable iterator. Note that the release method has nothing to do in this implementation.

Author:
Brett Henderson

Constructor Summary
IteratorReleasableIterator(java.util.Iterator<T> iterator)
          Creates a new instance.
 
Method Summary
 boolean hasNext()
          
 T next()
          
 void release()
          Performs resource cleanup tasks such as closing files, or database connections.
 void remove()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IteratorReleasableIterator

public IteratorReleasableIterator(java.util.Iterator<T> iterator)
Creates a new instance.

Parameters:
iterator - The underlying iterator to read from.
Method Detail

hasNext

public boolean hasNext()

Specified by:
hasNext in interface java.util.Iterator<T>

next

public T next()

Specified by:
next in interface java.util.Iterator<T>

remove

public void remove()

Specified by:
remove in interface java.util.Iterator<T>

release

public void release()
Performs resource cleanup tasks such as closing files, or database connections. This must be called after all processing is complete and may be called multiple times. Implementations must call release on any nested Releasable objects. It should be called within a finally block to ensure it is called in exception scenarios.

Specified by:
release in interface Releasable