Package org.apache.commons.io.function
Interface IOSpliterator<T>
-
- Type Parameters:
T- the type of elements returned by this IOSpliterator.
public interface IOSpliterator<T>LikeSpliteratorbut throwsIOException.- Since:
- 2.12.0
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description static <E> IOSpliterator<E>adapt(java.util.Spliterator<E> iterator)Adapts the given Spliterator as an IOSpliterator.default java.util.Spliterator<T>asSpliterator()Constructs aSpliteratorfor this instance that throwsUncheckedIOExceptioninstead ofIOException.default intcharacteristics()LikeSpliterator.characteristics().default longestimateSize()LikeSpliterator.estimateSize().default voidforEachRemaining(IOConsumer<? super T> action)LikeSpliterator.forEachRemaining(Consumer).default IOComparator<? super T>getComparator()LikeSpliterator.getComparator().default longgetExactSizeIfKnown()LikeSpliterator.getExactSizeIfKnown().default booleanhasCharacteristics(int characteristics)LikeSpliterator.hasCharacteristics(int).default booleantryAdvance(IOConsumer<? super T> action)LikeSpliterator.tryAdvance(Consumer).default IOSpliterator<T>trySplit()LikeSpliterator.trySplit().java.util.Spliterator<T>unwrap()Unwraps this instance and returns the underlyingSpliterator.
-
-
-
Method Detail
-
adapt
static <E> IOSpliterator<E> adapt(java.util.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 java.util.Spliterator<T> asSpliterator()
Constructs aSpliteratorfor this instance that throwsUncheckedIOExceptioninstead ofIOException.- Returns:
- an
UncheckedIOExceptionSpliterator.
-
characteristics
default int characteristics()
LikeSpliterator.characteristics().- Returns:
- a representation of characteristics
-
estimateSize
default long estimateSize()
LikeSpliterator.estimateSize().- Returns:
- the estimated size, or
Long.MAX_VALUEif infinite, unknown, or too expensive to compute.
-
forEachRemaining
default void forEachRemaining(IOConsumer<? super T> action)
LikeSpliterator.forEachRemaining(Consumer).- Parameters:
action- The action- Throws:
java.lang.NullPointerException- if the specified action is null
-
getComparator
default IOComparator<? super T> getComparator()
LikeSpliterator.getComparator().- Returns:
- a Comparator, or
nullif the elements are sorted in the natural order. - Throws:
java.lang.IllegalStateException- if the spliterator does not report a characteristic ofSORTED.
-
getExactSizeIfKnown
default long getExactSizeIfKnown()
LikeSpliterator.getExactSizeIfKnown().- Returns:
- the exact size, if known, else
-1.
-
hasCharacteristics
default boolean hasCharacteristics(int characteristics)
LikeSpliterator.hasCharacteristics(int).- Parameters:
characteristics- the characteristics to check for- Returns:
trueif all the specified characteristics are present, elsefalse
-
tryAdvance
default boolean tryAdvance(IOConsumer<? super T> action)
LikeSpliterator.tryAdvance(Consumer).- Parameters:
action- The action- Returns:
falseif no remaining elements existed upon entry to this method, elsetrue.- Throws:
java.lang.NullPointerException- if the specified action is null
-
trySplit
default IOSpliterator<T> trySplit()
LikeSpliterator.trySplit().- Returns:
- a
Spliteratorcovering some portion of the elements, ornullif this spliterator cannot be split
-
unwrap
java.util.Spliterator<T> unwrap()
Unwraps this instance and returns the underlyingSpliterator.Implementations may not have anything to unwrap and that behavior is undefined for now.
- Returns:
- the underlying Spliterator.
-
-