Package org.apache.commons.io.function

# Interface IOIterable<T>

Type Parameters:
  `T` - the type of elements returned by the iterable.

All Known Implementing Classes:
  `ReversedLinesFileReader`

public interface IOIterable<T>
Like `Iterable` but throws `IOException`.

Since:
  2.19.0

- ## Method Summary

  Modifier and Type
  Method
  Description
  `default Iterable<T>`
  `asIterable()`
  Creates an `Iterable` for this instance that throws `UncheckedIOException` instead of `IOException`.
  `default void`
  `forEach(IOConsumer<? super T> action)`
  Like `Iterable.iterator()`.
  `IOIterator<T>`
  `iterator()`
  Like `Iterable.iterator()`.
  `default IOSpliterator<T>`
  `spliterator()`
  Like `Iterable.spliterator()`.
  `Iterable<T>`
  `unwrap()`
  Unwraps this instance and returns the underlying `Iterable`.

- ## Method Details

  - ### asIterable

    default Iterable<T> asIterable()
    Creates an `Iterable` for this instance that throws `UncheckedIOException` instead of `IOException`.
    Returns:
      an `UncheckedIOException` `Iterable`.
    Since:
      2.21.0

  - ### forEach

    default void forEach(IOConsumer<? super T> action) throws IOException
    Like `Iterable.iterator()`.
    Parameters:
      `action` - The action to be performed for each element.
    Throws:
      `NullPointerException` - Thrown if the specified action is null.
      `IOException` - Thrown if an I/O error occurs for a remaining element, or the given action throws.
    See Also:
      - `Iterable.iterator()`

  - ### iterator

    IOIterator<T> iterator()
    Like `Iterable.iterator()`.
    Returns:
      See `delegate`.
    See Also:
      - `Iterable.iterator()`

  - ### spliterator

    default IOSpliterator<T> spliterator()
    Like `Iterable.spliterator()`.
    Returns:
      See `delegate`.
    See Also:
      - `Iterable.spliterator()`

  - ### unwrap

    Iterable<T> unwrap()
    Unwraps this instance and returns the underlying `Iterable`.

    Implementations may not have anything to unwrap and that behavior is undefined for now.

    Returns:
      the underlying Iterable.