This project has retired. For details please refer to its
Attic page .
AutoClosingIterator (Apache Crunch 0.3.0-incubating API)
org.apache.crunch.io.impl
Class AutoClosingIterator<T>
java.lang.Object
com.google.common.collect.UnmodifiableIterator<T>
org.apache.crunch.io.impl.AutoClosingIterator<T>
All Implemented Interfaces: Closeable , Iterator <T>
public class AutoClosingIterator<T> extends com.google.common.collect.UnmodifiableIterator<T>implements Iterator <T>, Closeable
Closes the wrapped Closeable
when hasNext()
returns false. As long a client loops through to
completion (doesn't abort early due to an exception, short circuit, etc.) resources will be closed automatically.
Methods inherited from class com.google.common.collect.UnmodifiableIterator
remove
AutoClosingIterator
public AutoClosingIterator (Closeable closeable,
Iterator <T > iter)
hasNext
public boolean hasNext ()
Specified by: hasNext
in interface Iterator <T >
next
public T next ()
Specified by: next
in interface Iterator <T >
close
public void close ()
throws IOException
Specified by: close
in interface Closeable
Throws:
IOException
Copyright © 2012 The Apache Software Foundation . All Rights Reserved.