public final class Streams extends Object
Stream and related objects from Chronicle Queues and other MarshallableIn types.
If the provided extractor is reusing objects, then care must be taken in the
returned objects (e.g. Streams, Spliterators and Iterators) to account for this.
Generally, these objects will create underlying objects and should not be used in JVMs running deterministic low-latency code. Instead, they are suitable for convenient off-line analysis of queue content.
| Modifier and Type | Method and Description |
|---|---|
static <T> @NotNull Iterator<T> |
iterator(@NotNull MarshallableIn documentProvider,
@NotNull DocumentExtractor<T> extractor)
Creates and returns a new
Iterator whose elements are obtained
by successively applying the provided extractor on excerpts from the
provided documentProvider. |
static PrimitiveIterator.OfDouble |
iteratorOfDouble(@NotNull MarshallableIn documentProvider,
@NotNull ToDoubleDocumentExtractor extractor)
Creates and returns a new
PrimitiveIterator.OfDouble whose elements are obtained
by successively applying the provided extractor on excerpts from the
provided documentProvider. |
static PrimitiveIterator.OfLong |
iteratorOfLong(@NotNull MarshallableIn documentProvider,
@NotNull ToLongDocumentExtractor extractor)
Creates and returns a new
PrimitiveIterator.OfLong whose elements are obtained
by successively applying the provided extractor on excerpts from the
provided documentProvider. |
static <T> @NotNull Stream<T> |
of(@NotNull MarshallableIn documentProvider,
@NotNull DocumentExtractor<T> extractor)
Creates and returns a new sequential ordered
Stream whose elements are obtained
by successively applying the provided extractor on excerpts from the
provided documentProvider. |
static @NotNull DoubleStream |
ofDouble(@NotNull MarshallableIn documentProvider,
@NotNull ToDoubleDocumentExtractor extractor)
Creates and returns a new sequential ordered
DoubleStream whose elements are obtained
by successively applying the provided extractor on excerpts from the
provided documentProvider. |
static @NotNull LongStream |
ofLong(@NotNull MarshallableIn documentProvider,
@NotNull ToLongDocumentExtractor extractor)
Creates and returns a new sequential ordered
LongStream whose elements are obtained
by successively applying the provided extractor on excerpts from the
provided documentProvider. |
static <T> @NotNull Spliterator<T> |
spliterator(@NotNull MarshallableIn documentProvider,
@NotNull DocumentExtractor<T> extractor)
Creates and returns a new ordered
Spliterator whose elements are obtained
by successively applying the provided extractor on excerpts from the
provided documentProvider, with no initial size estimate. |
static Spliterator.OfDouble |
spliteratorOfDouble(@NotNull MarshallableIn documentProvider,
@NotNull ToDoubleDocumentExtractor extractor)
Creates and returns a new ordered
Spliterator.OfDouble whose elements are obtained
by successively applying the provided extractor on excerpts from the
provided documentProvider, with no initial size estimate. |
static Spliterator.OfLong |
spliteratorOfLong(@NotNull MarshallableIn documentProvider,
@NotNull ToLongDocumentExtractor extractor)
Creates and returns a new ordered
Spliterator.OfLong whose elements are obtained
by successively applying the provided extractor on excerpts from the
provided documentProvider, with no initial size estimate. |
@NotNull public static <T> @NotNull Stream<T> of(@NotNull @NotNull MarshallableIn documentProvider, @NotNull @NotNull DocumentExtractor<T> extractor)
Stream whose elements are obtained
by successively applying the provided extractor on excerpts from the
provided documentProvider.
The Stream does not contain any null elements.
Tailers are handled in a thread-safe way and if a parallel stream is to be used, thread
safety checks must be turned off using the ExcerptTailer#disableThreadSafetyCheck(boolean) method or
else an Exception might be thrown during Stream evaluation.
T - the type of stream elementsdocumentProvider - from which excerpts are obtainedextractor - used to extract elements of type T from excerptsNullPointerException - if any of the provided parameters are null@NotNull public static @NotNull LongStream ofLong(@NotNull @NotNull MarshallableIn documentProvider, @NotNull @NotNull ToLongDocumentExtractor extractor)
LongStream whose elements are obtained
by successively applying the provided extractor on excerpts from the
provided documentProvider.
The Stream does not contain any Long.MIN_VALUE elements.
Tailers are handled in a thread-safe way and if a parallel stream is to be used, thread
safety checks must be turned off using the ExcerptTailer#disableThreadSafetyCheck(boolean) method or
else an Exception might be thrown during Stream evaluation.
documentProvider - from which excerpts are obtainedextractor - used to extract elements of type long from excerptsNullPointerException - if any of the provided parameters are null@NotNull public static @NotNull DoubleStream ofDouble(@NotNull @NotNull MarshallableIn documentProvider, @NotNull @NotNull ToDoubleDocumentExtractor extractor)
DoubleStream whose elements are obtained
by successively applying the provided extractor on excerpts from the
provided documentProvider.
The Stream does not contain any Double.NaN elements.
Tailers are handled in a thread-safe way and if a parallel stream is to be used, thread
safety checks must be turned off using the ExcerptTailer#disableThreadSafetyCheck(boolean) method or
else an Exception might be thrown during Stream evaluation.
documentProvider - from which excerpts are obtainedextractor - used to extract elements of type double from excerptsNullPointerException - if any of the provided parameters are null@NotNull public static <T> @NotNull Spliterator<T> spliterator(@NotNull @NotNull MarshallableIn documentProvider, @NotNull @NotNull DocumentExtractor<T> extractor)
Spliterator whose elements are obtained
by successively applying the provided extractor on excerpts from the
provided documentProvider, with no initial size estimate.
The Spliterator does not contain any null elements.
The Spliterator implements trySplit to permit limited parallelism.
Tailers are handled in a thread-safe way and if a Spliterator splits are anticipated, thread
safety checks must be turned off using the ExcerptTailer#disableThreadSafetyCheck(boolean) method or
else an Exception might be thrown during splits.
T - the type of stream elementsdocumentProvider - from which excerpts are obtainedextractor - used to extract elements of type T from excerptsNullPointerException - if any of the provided parameters are null@NotNull public static Spliterator.OfLong spliteratorOfLong(@NotNull @NotNull MarshallableIn documentProvider, @NotNull @NotNull ToLongDocumentExtractor extractor)
Spliterator.OfLong whose elements are obtained
by successively applying the provided extractor on excerpts from the
provided documentProvider, with no initial size estimate.
The Spliterator does not contain any Long.MIN_VALUE elements.
The Spliterator implements trySplit to permit limited parallelism.
Tailers are handled in a thread-safe way and if a Spliterator splits are anticipated, thread
safety checks must be turned off using the ExcerptTailer#disableThreadSafetyCheck(boolean) method or
else an Exception might be thrown during splits.
documentProvider - from which excerpts are obtainedextractor - used to extract elements of type long from excerptsNullPointerException - if any of the provided parameters are null@NotNull public static Spliterator.OfDouble spliteratorOfDouble(@NotNull @NotNull MarshallableIn documentProvider, @NotNull @NotNull ToDoubleDocumentExtractor extractor)
Spliterator.OfDouble whose elements are obtained
by successively applying the provided extractor on excerpts from the
provided documentProvider, with no initial size estimate.
The Spliterator does not contain any Double.NaN elements.
The Spliterator implements trySplit to permit limited parallelism.
Tailers are handled in a thread-safe way and if a Spliterator splits are anticipated, thread
safety checks must be turned off using the ExcerptTailer#disableThreadSafetyCheck(boolean) method or
else an Exception might be thrown during splits.
documentProvider - from which excerpts are obtainedextractor - used to extract elements of type double from excerptsNullPointerException - if any of the provided parameters are null@NotNull public static <T> @NotNull Iterator<T> iterator(@NotNull @NotNull MarshallableIn documentProvider, @NotNull @NotNull DocumentExtractor<T> extractor)
Iterator whose elements are obtained
by successively applying the provided extractor on excerpts from the
provided documentProvider.
The Iterator does not contain any null elements.
The returned iterator is confined to a single thread.
T - the type of stream elementsdocumentProvider - from which excerpts are obtainedextractor - used to extract elements of type T from excerptsNullPointerException - if any of the provided parameters are null@NotNull public static PrimitiveIterator.OfLong iteratorOfLong(@NotNull @NotNull MarshallableIn documentProvider, @NotNull @NotNull ToLongDocumentExtractor extractor)
PrimitiveIterator.OfLong whose elements are obtained
by successively applying the provided extractor on excerpts from the
provided documentProvider.
The Iterator does not contain any Long.MIN_VALUE elements.
The returned iterator is confined to a single thread.
documentProvider - from which excerpts are obtainedextractor - used to extract elements of type long from excerptsNullPointerException - if any of the provided parameters are null@NotNull public static PrimitiveIterator.OfDouble iteratorOfDouble(@NotNull @NotNull MarshallableIn documentProvider, @NotNull @NotNull ToDoubleDocumentExtractor extractor)
PrimitiveIterator.OfDouble whose elements are obtained
by successively applying the provided extractor on excerpts from the
provided documentProvider.
The Iterator does not contain any Double.NaN elements.
The returned iterator is confined to a single thread.
documentProvider - from which excerpts are obtainedextractor - used to extract elements of type double from excerptsNullPointerException - if any of the provided parameters are nullCopyright © 2023. All rights reserved.