Class ObservableBlockingSubscribe


  • public final class ObservableBlockingSubscribe
    extends java.lang.Object
    Utility methods to consume an Observable in a blocking manner with callbacks or Observer.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <T> void subscribe​(ObservableSource<? extends T> o)
      Runs the source observable to a terminal event, ignoring any values and rethrowing any exception.
      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.
      static <T> void subscribe​(ObservableSource<? extends T> o, Consumer<? super T> onNext, Consumer<? super java.lang.Throwable> onError, Action onComplete)
      Subscribes to the source and calls the given actions on the current thread.
      • Methods inherited from class java.lang.Object

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

      • ObservableBlockingSubscribe

        private ObservableBlockingSubscribe()
        Utility class.
    • Method Detail

      • 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:
        java.lang.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 java.lang.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.