Package io.pravega.common.util
Interface CloseableIterator<T,TEx extends java.lang.Exception>
-
- All Superinterfaces:
java.lang.AutoCloseable
public interface CloseableIterator<T,TEx extends java.lang.Exception> extends java.lang.AutoCloseableDefines an Iterator that can be closed. This can be used for such iterators that need to acquire or make use of expensive system resources, such as network connections or file handles. Closing the iterator will release all such resources, even if getNext() indicates that it hasn't reached the end.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidclose()Closes the Iterator.TgetNext()Gets the next item in the iteration.
-
-
-
Method Detail
-
getNext
T getNext() throws TEx extends java.lang.Exception
Gets the next item in the iteration.- Returns:
- The next item, or null if no more elements.
- Throws:
ObjectClosedException- If the CloseableIterator has been closed.TEx- If an exception of this type occurred.TEx extends java.lang.Exception
-
close
void close()
Closes the Iterator.- Specified by:
closein interfacejava.lang.AutoCloseable
-
-