Class FlowAdapters

java.lang.Object
org.reactivestreams.FlowAdapters

public final class FlowAdapters extends Object
Bridge between Reactive Streams API and the Java 9 Flow API.
  • Constructor Details

    • FlowAdapters

      private FlowAdapters()
      Utility class.
  • Method Details

    • toPublisher

      public static <T> Publisher<T> toPublisher(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> 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(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> 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> 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(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