Package org.n52.shetland.ogc.om
Interface ObservationStream
- All Superinterfaces:
AutoCloseable,ThrowingIterator<OmObservation,OwsExceptionReport>
- All Known Implementing Classes:
AbstractObservationStream,AbstractStreaming,StreamingValue
public interface ObservationStream
extends ThrowingIterator<OmObservation,OwsExceptionReport>, AutoCloseable
TODO JavaDoc
-
Method Summary
Modifier and TypeMethodDescriptiondefault voidclose()default <T extends Collection<OmObservation>>
Tstatic ObservationStreamempty()Creates an empty observation stream.default ObservationStreamfilter(Predicate<OmObservation> predicate) Creates a new observation stream that filters the observatons from the original stream using the supplied predicate.default Optional<OmObservation> findAny()As this stream is always serial this is the same asfindFirst().default Optional<OmObservation> Gets the next value that is in the stream.default ObservationStreamCreates a new observation stream from a mapping function that produces a stream for every observation in this stream.default ObservationStreammap(ThrowingUnaryOperator<OmObservation, OwsExceptionReport> operator) Produces a observation new stream from a mapping function that produces a new observation for every observation in this stream.default ObservationStreammerge()Creates a new stream out of this stream in which observations with the same observation constellation are merged.default ObservationStreammerge(ObservationMergeIndicator indicator) Creates a new stream out of this stream in which observations with the same observation constellation are merged.default ObservationStreammodify(ThrowingConsumer<OmObservation, OwsExceptionReport> consumer) Creates a new observation stream from an consumer that consumes every observation before it is emitted by the stream.static ObservationStreamof(Iterable<OmObservation> observations) Creates a new observation stream from the supplied iterable.static ObservationStreamof(Iterator<OmObservation> observations) Creates a new observation stream from the supplied iterator.static ObservationStreamof(OmObservation observation) Creates a new observation stream from the supplied observation.default Stream<OmObservation> toStream()Creates a new stream of this observation stream.Methods inherited from interface org.n52.janmayen.ThrowingIterator
forEachRemaining, hasNext, next, remove
-
Method Details
-
close
default void close()- Specified by:
closein interfaceAutoCloseable
-
collect
default <T extends Collection<OmObservation>> T collect(Supplier<T> supplier) throws OwsExceptionReport - Throws:
OwsExceptionReport
-
findFirst
Gets the next value that is in the stream.- Returns:
- the first observation of the stream
- Throws:
OwsExceptionReport- if an error occurs during observation retrieval
-
toStream
Creates a new stream of this observation stream. Note that consuming the stream will drain the iterator and all thrown exceptions will be wrapped inRuntimeExceptions.- Returns:
- the stream
-
findAny
As this stream is always serial this is the same asfindFirst().- Returns:
- the first observation of the stream
- Throws:
OwsExceptionReport- if an error occurs during observation retrieval
-
modify
Creates a new observation stream from an consumer that consumes every observation before it is emitted by the stream.- Parameters:
consumer- the consumer- Returns:
- the new stream
-
flatMap
default ObservationStream flatMap(ThrowingFunction<OmObservation, ObservationStream, OwsExceptionReport> mapper) Creates a new observation stream from a mapping function that produces a stream for every observation in this stream.- Parameters:
mapper- the mapping function- Returns:
- the new stream
-
map
Produces a observation new stream from a mapping function that produces a new observation for every observation in this stream.- Parameters:
operator- the mapping function- Returns:
- the new stream
-
filter
Creates a new observation stream that filters the observatons from the original stream using the supplied predicate.- Parameters:
predicate- the filter- Returns:
- the new stream
-
merge
Creates a new stream out of this stream in which observations with the same observation constellation are merged. Be aware that this method will consume this stream completely.- Returns:
- the new observation stream
- Throws:
OwsExceptionReport- if an error occurs during observation retrieval- See Also:
-
merge
Creates a new stream out of this stream in which observations with the same observation constellation are merged. Be aware that this method will consume this stream completely.- Parameters:
indicator-- Returns:
- the new observation stream
- Throws:
OwsExceptionReport- if an error occurs during observation retrieval- See Also:
-
empty
Creates an empty observation stream.- Returns:
- the stream
-
of
Creates a new observation stream from the supplied iterator.- Parameters:
observations- the observations- Returns:
- the stream
-
of
Creates a new observation stream from the supplied iterable.- Parameters:
observations- the observations- Returns:
- the stream
-
of
Creates a new observation stream from the supplied observation.- Parameters:
observation- the observation- Returns:
- the stream
-