Package org.apache.commons.io.function
Interface IOIterator<E>
- Type Parameters:
E
- the type of elements returned by this iterator.
public interface IOIterator<E>
Like
Iterator
but throws IOException
.- Since:
- 2.12.0
-
Method Summary
Modifier and TypeMethodDescriptionstatic <E> IOIterator<E>
Adapts the given Iterable as an IOIterator.static <E> IOIterator<E>
Adapts the given Iterator as an IOIterator.default void
forEachRemaining
(IOConsumer<? super E> action) boolean
hasNext()
LikeIterator.hasNext()
.next()
LikeIterator.next()
.default void
remove()
LikeIterator.remove()
.unwrap()
Unwraps this instance and returns the underlyingIterator
.
-
Method Details
-
adapt
Adapts the given Iterable as an IOIterator.- Type Parameters:
E
- the type of the stream elements.- Parameters:
iterable
- The iterable to adapt- Returns:
- A new IOIterator
- Since:
- 2.17.0
-
adapt
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
- Returns:
- an
UncheckedIOException
Iterator
.
-
forEachRemaining
- Parameters:
action
- See delegate.- Throws:
IOException
- if an I/O error occurs.
-
hasNext
LikeIterator.hasNext()
.- Returns:
- See delegate.
- Throws:
IOException
- if an I/O error occurs.
-
next
LikeIterator.next()
.- Returns:
- See delegate.
- Throws:
IOException
- if an I/O error occurs.NoSuchElementException
- if the iteration has no more elements
-
remove
LikeIterator.remove()
.- Throws:
IOException
- if an I/O error occurs.
-
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.
-