Class ObservableBlockingSubscribe

java.lang.Object
io.reactivex.rxjava3.internal.operators.observable.ObservableBlockingSubscribe

public final class ObservableBlockingSubscribe extends Object
Utility methods to consume an Observable in a blocking manner with callbacks or Observer.
  • Constructor Details

    • ObservableBlockingSubscribe

      private ObservableBlockingSubscribe()
      Utility class.
  • Method Details

    • subscribe

      public static <T> void subscribe(ObservableSource<? extends T> o, Observer<? super T> observer)
      Subscribes to the source and calls the Observer methods on the current thread.

      Type Parameters:
      T - the value type
      Parameters:
      o - the source ObservableSource The call to dispose() is composed through.
      observer - the subscriber to forward events and calls to in the current thread
      Throws:
      NullPointerException - if observer is null
    • subscribe

      public static <T> void subscribe(ObservableSource<? extends T> o)
      Runs the source observable to a terminal event, ignoring any values and rethrowing any exception.
      Type Parameters:
      T - the value type
      Parameters:
      o - the source ObservableSource
    • subscribe

      public static <T> void subscribe(ObservableSource<? extends T> o, Consumer<? super T> onNext, Consumer<? super Throwable> onError, Action onComplete)
      Subscribes to the source and calls the given actions on the current thread.
      Type Parameters:
      T - the value type
      Parameters:
      o - the source ObservableSource
      onNext - the callback action for each source value
      onError - the callback action for an error event
      onComplete - the callback action for the completion event.