Package org.apache.commons.io.function
Interface IOIterator<E>
-
- Type Parameters:
E
- the type of elements returned by this iterator.
public interface IOIterator<E>
LikeIterator
but 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 anIterator
for this instance that throwsUncheckedIOException
instead ofIOException
.default void
forEachRemaining(IOConsumer<? super E> action)
LikeIterator.forEachRemaining(Consumer)
.boolean
hasNext()
LikeIterator.hasNext()
.E
next()
LikeIterator.next()
.default void
remove()
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 anIterator
for this instance that throwsUncheckedIOException
instead ofIOException
.- Returns:
- an
UncheckedIOException
Iterator
.
-
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.IOException
LikeIterator.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.IOException
LikeIterator.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.
-
-