public interface ObjectStream<T>
extends java.io.Closeable, java.util.stream.Stream<T>, java.lang.Iterable<T>
A stream of objects read from somewhere.
This interface extends Iterable
for convenience; the BaseStream.iterator()
method does not return a fresh iterator but rather a wrapper of this stream. It is only present to allow for-each loops over streams. After it is exhausted, any iterator returned will be null.
AbstractObjectStream
Modifier and Type | Method and Description |
---|---|
void |
close()
Close the stream.
|
default void |
forEach(java.util.function.Consumer<? super T> action) |
T |
readObject()
Read the next object from this stream.
|
default java.util.Spliterator<T> |
spliterator() |
allMatch, anyMatch, builder, collect, collect, concat, count, distinct, empty, filter, findAny, findFirst, flatMap, flatMapToDouble, flatMapToInt, flatMapToLong, forEachOrdered, generate, iterate, limit, map, mapToDouble, mapToInt, mapToLong, max, min, noneMatch, of, of, peek, reduce, reduce, reduce, skip, sorted, sorted, toArray, toArray
@CheckForNull T readObject()
Read the next object from this stream.
null
if at the end of the stream.void close()
Close the stream. This invalidates the stream; no more elements may be fetched after a call to close()
(although implementations are not required to enforce this). It is not an error to close a stream multiple times.
default void forEach(java.util.function.Consumer<? super T> action)