Merge pull request #20141 from agolubev/19443-add-support-for-Java-Stream-agolubev
19443 add support for java stream agolubev
This commit is contained in:
commit
c3c8a0bc73
18 changed files with 684 additions and 59 deletions
|
|
@ -447,11 +447,48 @@ The ``InputStream`` will be closed when the ``Source`` is canceled from its down
|
|||
asOutputStream
|
||||
^^^^^^^^^^^^^^
|
||||
Create a source that materializes into an ``OutputStream``. When bytes are written to the ``OutputStream`` they
|
||||
are emitted from the source
|
||||
are emitted from the source.
|
||||
|
||||
The ``OutputStream`` will no longer be writable when the ``Source`` has been canceled from its downstream, and
|
||||
closing the ``OutputStream`` will complete the ``Source``.
|
||||
|
||||
asJavaStream
|
||||
^^^^^^^^^^^^
|
||||
Create a sink which materializes into Java 8 ``Stream`` that can be run to trigger demand through the sink.
|
||||
Elements emitted through the stream will be available for reading through the Java 8 ``Stream``.
|
||||
|
||||
The Java 8 a ``Stream`` will be ended when the stream flowing into this ``Sink`` completes, and closing the Java
|
||||
``Stream`` will cancel the inflow of this ``Sink``. Java ``Stream`` throws exception in case reactive stream failed.
|
||||
|
||||
Be aware that Java 8 ``Stream`` blocks current thread while waiting on next element from downstream.
|
||||
|
||||
fromJavaStream
|
||||
^^^^^^^^^^^^^^
|
||||
Create a source that wraps Java 8 ``Stream``. ``Source`` uses a stream iterator to get all its elements and send them
|
||||
downstream on demand.
|
||||
|
||||
javaCollector
|
||||
^^^^^^^^^^^^^
|
||||
Create a sink which materializes into a ``CompletionStage`` which will be completed with a result of the Java 8 ``Collector``
|
||||
transformation and reduction operations. This allows usage of Java 8 streams transformations for reactive streams.
|
||||
The ``Collector`` will trigger demand downstream. Elements emitted through the stream will be accumulated into a mutable
|
||||
result container, optionally transformed into a final representation after all input elements have been processed.
|
||||
The ``Collector`` can also do reduction at the end. Reduction processing is performed sequentially
|
||||
|
||||
Note that a flow can be materialized multiple times, so the function producing the ``Collector`` must be able
|
||||
to handle multiple invocations.
|
||||
|
||||
javaCollectorParallelUnordered
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
Create a sink which materializes into a ``CompletionStage`` which will be completed with a result of the Java 8 Collector
|
||||
transformation and reduction operations. This allows usage of Java 8 streams transformations for reactive streams.
|
||||
The ``Collector`` will trigger demand downstream.. Elements emitted through the stream will be accumulated into a mutable
|
||||
result container, optionally transformed into a final representation after all input elements have been processed.
|
||||
The ``Collector`` can also do reduction at the end. Reduction processing is performed in parallel based on graph ``Balance``.
|
||||
|
||||
Note that a flow can be materialized multiple times, so the function producing the ``Collector`` must be able
|
||||
to handle multiple invocations.
|
||||
|
||||
File IO Sinks and Sources
|
||||
-------------------------
|
||||
Sources and sinks for reading and writing files can be found on ``FileIO``.
|
||||
|
|
|
|||
|
|
@ -436,11 +436,48 @@ The ``InputStream`` will be closed when the ``Source`` is canceled from its down
|
|||
asOutputStream
|
||||
^^^^^^^^^^^^^^
|
||||
Create a source that materializes into an ``OutputStream``. When bytes are written to the ``OutputStream`` they
|
||||
are emitted from the source
|
||||
are emitted from the source.
|
||||
|
||||
The ``OutputStream`` will no longer be writable when the ``Source`` has been canceled from its downstream, and
|
||||
closing the ``OutputStream`` will complete the ``Source``.
|
||||
|
||||
asJavaStream
|
||||
^^^^^^^^^^^^
|
||||
Create a sink which materializes into Java 8 ``Stream`` that can be run to trigger demand through the sink.
|
||||
Elements emitted through the stream will be available for reading through the Java 8 ``Stream``.
|
||||
|
||||
The Java 8 ``Stream`` will be ended when the stream flowing into this ``Sink`` completes, and closing the Java
|
||||
``Stream`` will cancel the inflow of this ``Sink``. Java ``Stream`` throws exception in case reactive stream failed.
|
||||
|
||||
Be aware that Java ``Stream`` blocks current thread while waiting on next element from downstream.
|
||||
|
||||
fromJavaStream
|
||||
^^^^^^^^^^^^^^
|
||||
Create a source that wraps a Java 8 ``Stream``. ``Source`` uses a stream iterator to get all its elements and send them
|
||||
downstream on demand.
|
||||
|
||||
javaCollector
|
||||
^^^^^^^^^^^^^
|
||||
Create a sink which materializes into a ``Future`` which will be completed with a result of the Java 8 ``Collector``
|
||||
transformation and reduction operations. This allows usage of Java 8 streams transformations for reactive streams.
|
||||
The ``Collector`` will trigger demand downstream. Elements emitted through the stream will be accumulated into a mutable
|
||||
result container, optionally transformed into a final representation after all input elements have been processed.
|
||||
The ``Collector`` can also do reduction at the end. Reduction processing is performed sequentially
|
||||
|
||||
Note that a flow can be materialized multiple times, so the function producing the ``Collector`` must be able
|
||||
to handle multiple invocations.
|
||||
|
||||
javaCollectorParallelUnordered
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
Create a sink which materializes into a ``Future`` which will be completed with a result of the Java 8 ``Collector``
|
||||
transformation and reduction operations. This allows usage of Java 8 streams transformations for reactive streams.
|
||||
The ``Collector`` is triggering demand downstream. Elements emitted through the stream will be accumulated into a mutable
|
||||
result container, optionally transformed into a final representation after all input elements have been processed.
|
||||
The ``Collector`` can also do reduction at the end. Reduction processing is performed in parallel based on graph ``Balance``.
|
||||
|
||||
Note that a flow can be materialized multiple times, so the function producing the ``Collector`` must be able
|
||||
to handle multiple invocations.
|
||||
|
||||
File IO Sinks and Sources
|
||||
-------------------------
|
||||
Sources and sinks for reading and writing files can be found on ``FileIO``.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue