org.apache.commons.io.function

## Interface IOSpliterator<T>

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

      public interface IOSpliterator<T>

  Like `Spliterator` but throws `IOException`.
  Since:
    2.12.0

- - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Default Methods
    Modifier and Type | Method and Description
    --- | ---
    `static <E> IOSpliterator<E>` | `adapt(Spliterator<E> iterator)` Adapts the given Spliterator as an IOSpliterator.
    `default Spliterator<T>` | `asSpliterator()` Creates a `Spliterator` for this instance that throws `UncheckedIOException` instead of `IOException`.
    `default int` | `characteristics()` Like `Spliterator.characteristics()`.
    `default long` | `estimateSize()` Like `Spliterator.estimateSize()`.
    `default void` | `forEachRemaining(IOConsumer<? super T> action)` Like `Spliterator.forEachRemaining(Consumer)`.
    `default IOComparator<? super T>` | `getComparator()` Like `Spliterator.getComparator()`.
    `default long` | `getExactSizeIfKnown()` Like `Spliterator.getExactSizeIfKnown()`.
    `default boolean` | `hasCharacteristics(int characteristics)` Like `Spliterator.hasCharacteristics(int)`.
    `default boolean` | `tryAdvance(IOConsumer<? super T> action)` Like `Spliterator.tryAdvance(Consumer)`.
    `default IOSpliterator<T>` | `trySplit()` Like `Spliterator.trySplit()`.
    `Spliterator<T>` | `unwrap()` Unwraps this instance and returns the underlying `Spliterator`.

- - ### Method Detail

    - #### adapt

          static <E> IOSpliterator<E> adapt(Spliterator<E> iterator)

      Adapts the given Spliterator as an IOSpliterator.
      Type Parameters:
        `E` - the type of the stream elements.
      Parameters:
        `iterator` - The iterator to adapt
      Returns:
        A new IOSpliterator

    - #### asSpliterator

          default Spliterator<T> asSpliterator()

      Creates a `Spliterator` for this instance that throws `UncheckedIOException` instead of `IOException`.
      Returns:
        an `UncheckedIOException` `Spliterator`.

    - #### characteristics

          default int characteristics()

      Like `Spliterator.characteristics()`.
      Returns:
        a representation of characteristics

    - #### estimateSize

          default long estimateSize()

      Like `Spliterator.estimateSize()`.
      Returns:
        the estimated size, or `Long.MAX_VALUE` if infinite, unknown, or too expensive to compute.

    - #### forEachRemaining

          default void forEachRemaining(IOConsumer<? super T> action)

      Like `Spliterator.forEachRemaining(Consumer)`.
      Parameters:
        `action` - The action
      Throws:
        `NullPointerException` - if the specified action is null

    - #### getComparator

          default IOComparator<? super T> getComparator()

      Like `Spliterator.getComparator()`.
      Returns:
        a Comparator, or `null` if the elements are sorted in the natural order.
      Throws:
        `IllegalStateException` - if the spliterator does not report a characteristic of `SORTED`.

    - #### getExactSizeIfKnown

          default long getExactSizeIfKnown()

      Like `Spliterator.getExactSizeIfKnown()`.
      Returns:
        the exact size, if known, else `-1`.

    - #### hasCharacteristics

          default boolean hasCharacteristics(int characteristics)

      Like `Spliterator.hasCharacteristics(int)`.
      Parameters:
        `characteristics` - the characteristics to check for
      Returns:
        `true` if all the specified characteristics are present, else `false`

    - #### tryAdvance

          default boolean tryAdvance(IOConsumer<? super T> action)

      Like `Spliterator.tryAdvance(Consumer)`.
      Parameters:
        `action` - The action
      Returns:
        `false` if no remaining elements existed upon entry to this method, else `true`.
      Throws:
        `NullPointerException` - if the specified action is null

    - #### trySplit

          default IOSpliterator<T> trySplit()

      Like `Spliterator.trySplit()`.
      Returns:
        a `Spliterator` covering some portion of the elements, or `null` if this spliterator cannot be split

    - #### unwrap

          Spliterator<T> unwrap()

      Unwraps this instance and returns the underlying `Spliterator`.

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

      Returns:
        the underlying Spliterator.

Copyright © 2002–2023 The Apache Software Foundation. All rights reserved.