
public final class Streams extends Object
| Modifier | Constructor and Description |
|---|---|
private |
Streams() |
| Modifier and Type | Method and Description |
|---|---|
static Stream<Byte> |
fileToByteStream(File in,
Consumer<IOException> onFailure) |
static Stream<Byte> |
fileToByteStream(Path in,
Consumer<IOException> onFailure) |
static Stream<Byte> |
fileToByteStream(URL in,
Consumer<IOException> onFailure) |
static <E> Stream<E> |
flatten(E target,
Function<? super E,? extends Stream<? extends E>> extractor)
Flattens a recursive, tree-like, non circular data structure into a
Stream. |
static <T> Stream<T> |
iteratorToStream(Iterator<T> in) |
public static Stream<Byte> fileToByteStream(File in, Consumer<IOException> onFailure)
in - input resourceonFailure - executed in case of IOExceptionpublic static Stream<Byte> fileToByteStream(Path in, Consumer<IOException> onFailure)
in - input resourceonFailure - executed in case of IOExceptionpublic static Stream<Byte> fileToByteStream(URL in, Consumer<IOException> onFailure)
in - input resourceonFailure - executed in case of IOExceptionpublic static <E> Stream<E> flatten(E target, Function<? super E,? extends Stream<? extends E>> extractor)
Stream.E - the type of objecttarget - the root element of the structureextractor - the function that maps a node of the structure to a stream of
its childrenStream walking through the data structure