org.gcube.data.streams.adapters
Class IteratorAdapter<E>

java.lang.Object
  extended by org.gcube.data.streams.adapters.IteratorAdapter<E>
All Implemented Interfaces:
Closeable

public class IteratorAdapter<E>
extends Object
implements Closeable

An adaptation strategy for IteratorStream.

Author:
Fabio Simeoni
See Also:
IteratorStream

Constructor Summary
IteratorAdapter(Iterator<E> iterator)
          Creates an instance from a given Iterator.
 
Method Summary
 void close()
          Closes the underlying iterator.
 URI locator()
          Returns a locator for the underlying iterator.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IteratorAdapter

public IteratorAdapter(Iterator<E> iterator)
Creates an instance from a given Iterator.

Parameters:
iterator - the iterator
Method Detail

locator

public URI locator()
Returns a locator for the underlying iterator.

By default it returns a locator of the form local:<toString()>, where <toString()> is the string obtained by invoking Object.toString() on the iterator.

Returns:
the locator

close

public void close()
           throws IOException
Closes the underlying iterator.

By defaults it has no effect except when the iterator implements the Closeable interface. In this case, it simply delegates to the iterator.

Specified by:
close in interface Closeable
Throws:
IOException


Copyright © 2012. All Rights Reserved.