Package org.apache.commons.io.function
Interface IOIterator<E>
-
- Type Parameters:
E- the type of elements returned by this iterator.
public interface IOIterator<E>LikeIteratorbut throwsIOException.- Since:
- 2.12.0
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description static <E> IOIterator<E>adapt(java.util.Iterator<E> iterator)Adapts the given Iterator as an IOIterator.default java.util.Iterator<E>asIterator()Creates anIteratorfor this instance that throwsUncheckedIOExceptioninstead ofIOException.default voidforEachRemaining(IOConsumer<? super E> action)LikeIterator.forEachRemaining(Consumer).booleanhasNext()LikeIterator.hasNext().Enext()LikeIterator.next().default voidremove()LikeIterator.remove().java.util.Iterator<E>unwrap()Unwraps this instance and returns the underlyingIterator.
-
-
-
Method Detail
-
adapt
static <E> IOIterator<E> adapt(java.util.Iterator<E> iterator)
Adapts the given Iterator as an IOIterator.- Type Parameters:
E- the type of the stream elements.- Parameters:
iterator- The iterator to adapt- Returns:
- A new IOIterator
-
asIterator
default java.util.Iterator<E> asIterator()
Creates anIteratorfor this instance that throwsUncheckedIOExceptioninstead ofIOException.- Returns:
- an
UncheckedIOExceptionIterator.
-
forEachRemaining
default void forEachRemaining(IOConsumer<? super E> action) throws java.io.IOException
LikeIterator.forEachRemaining(Consumer).- Parameters:
action- See delegate.- Throws:
java.io.IOException- if an I/O error occurs.
-
hasNext
boolean hasNext() throws java.io.IOExceptionLikeIterator.hasNext().- Returns:
- See delegate.
- Throws:
java.io.IOException- if an I/O error occurs.
-
next
E next() throws java.io.IOException
LikeIterator.next().- Returns:
- See delegate.
- Throws:
java.io.IOException- if an I/O error occurs.java.util.NoSuchElementException- if the iteration has no more elements
-
remove
default void remove() throws java.io.IOExceptionLikeIterator.remove().- Throws:
java.io.IOException- if an I/O error occurs.
-
unwrap
java.util.Iterator<E> unwrap()
Unwraps this instance and returns the underlyingIterator.Implementations may not have anything to unwrap and that behavior is undefined for now.
- Returns:
- the underlying Iterator.
-
-