Class FlowAdapters


  • public final class FlowAdapters
    extends java.lang.Object
    Bridge between Reactive Streams API and the Java 9 Flow API.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <T,​U>
      java.util.concurrent.Flow.Processor<T,​U>
      toFlowProcessor​(Processor<? super T,​? extends U> reactiveStreamsProcessor)
      Converts a Reactive Streams Processor into a Flow Processor.
      static <T> java.util.concurrent.Flow.Publisher<T> toFlowPublisher​(Publisher<? extends T> reactiveStreamsPublisher)
      Converts a Reactive Streams Publisher into a Flow Publisher.
      static <T> java.util.concurrent.Flow.Subscriber<T> toFlowSubscriber​(Subscriber<T> reactiveStreamsSubscriber)
      Converts a Reactive Streams Subscriber into a Flow Subscriber.
      static <T,​U>
      Processor<T,​U>
      toProcessor​(java.util.concurrent.Flow.Processor<? super T,​? extends U> flowProcessor)
      Converts a Flow Processor into a Reactive Streams Processor.
      static <T> Publisher<T> toPublisher​(java.util.concurrent.Flow.Publisher<? extends T> flowPublisher)
      Converts a Flow Publisher into a Reactive Streams Publisher.
      static <T> Subscriber<T> toSubscriber​(java.util.concurrent.Flow.Subscriber<T> flowSubscriber)
      Converts a Flow Subscriber into a Reactive Streams Subscriber.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • toPublisher

        public static <T> Publisher<T> toPublisher​(java.util.concurrent.Flow.Publisher<? extends T> flowPublisher)
        Converts a Flow Publisher into a Reactive Streams Publisher.
        Type Parameters:
        T - the element type
        Parameters:
        flowPublisher - the source Flow Publisher to convert
        Returns:
        the equivalent Reactive Streams Publisher
      • toFlowPublisher

        public static <T> java.util.concurrent.Flow.Publisher<T> toFlowPublisher​(Publisher<? extends T> reactiveStreamsPublisher)
        Converts a Reactive Streams Publisher into a Flow Publisher.
        Type Parameters:
        T - the element type
        Parameters:
        reactiveStreamsPublisher - the source Reactive Streams Publisher to convert
        Returns:
        the equivalent Flow Publisher
      • toProcessor

        public static <T,​U> Processor<T,​U> toProcessor​(java.util.concurrent.Flow.Processor<? super T,​? extends U> flowProcessor)
        Converts a Flow Processor into a Reactive Streams Processor.
        Type Parameters:
        T - the input value type
        U - the output value type
        Parameters:
        flowProcessor - the source Flow Processor to convert
        Returns:
        the equivalent Reactive Streams Processor
      • toFlowProcessor

        public static <T,​U> java.util.concurrent.Flow.Processor<T,​U> toFlowProcessor​(Processor<? super T,​? extends U> reactiveStreamsProcessor)
        Converts a Reactive Streams Processor into a Flow Processor.
        Type Parameters:
        T - the input value type
        U - the output value type
        Parameters:
        reactiveStreamsProcessor - the source Reactive Streams Processor to convert
        Returns:
        the equivalent Flow Processor
      • toFlowSubscriber

        public static <T> java.util.concurrent.Flow.Subscriber<T> toFlowSubscriber​(Subscriber<T> reactiveStreamsSubscriber)
        Converts a Reactive Streams Subscriber into a Flow Subscriber.
        Type Parameters:
        T - the input and output value type
        Parameters:
        reactiveStreamsSubscriber - the Reactive Streams Subscriber instance to convert
        Returns:
        the equivalent Flow Subscriber
      • toSubscriber

        public static <T> Subscriber<T> toSubscriber​(java.util.concurrent.Flow.Subscriber<T> flowSubscriber)
        Converts a Flow Subscriber into a Reactive Streams Subscriber.
        Type Parameters:
        T - the input and output value type
        Parameters:
        flowSubscriber - the Flow Subscriber instance to convert
        Returns:
        the equivalent Reactive Streams Subscriber