public final classSubscribersextends java.lang.ObjectSubscriber objects.| Modifier and Type | Method and Description |
|---|---|
static <T> Subscriber<T> | create(Action1<? super T> onNext)Creates a Subscriber that receives the emissions of anyObservable it subscribes to viaonNext but ignoresonCompleted notifications; it will throw anOnErrorNotImplementedException ifonError is invoked. |
static <T> Subscriber<T> | create(Action1<? super T> onNext,Action1<java.lang.Throwable> onError)Creates an Subscriber that receives the emissions of anyObservable it subscribes to viaonNext and handles anyonError notification but ignores anonCompleted notification. |
static <T> Subscriber<T> | create(Action1<? super T> onNext,Action1<java.lang.Throwable> onError,Action0 onComplete)Creates an Subscriber that receives the emissions of anyObservable it subscribes to viaonNext and handles anyonError oronCompleted notifications. |
static <T> Subscriber<T> | empty()Returns an inert Subscriber that does nothing in response to the emissions or notifications from anyObservable it subscribes to. |
static <T> Subscriber<T> | from(Observer<? super T> o)Converts an Observer into aSubscriber. |
static <T> Subscriber<T> | wrap(Subscriber<? super T> subscriber)Returns a new Subscriber that passes all events tosubscriber, has backpressure controlled bysubscriber and uses the subscription list ofsubscriber whenSubscriber.add(rx.Subscription) is called. |
public static <T> Subscriber<T> empty()
Subscriber that does nothing in response to the emissions or notifications from anyObservable it subscribes to. Will throw anOnErrorNotImplementedException ifonError method is calledT - the observed value typeObserverpublic static <T> Subscriber<T> from(Observer<? super T> o)
Observer into aSubscriber.T - the observed value typeo - theObserver to convertSubscriber version ofopublic static <T> Subscriber<T> create(Action1<? super T> onNext)
Subscriber that receives the emissions of anyObservable it subscribes to viaonNext but ignoresonCompleted notifications; it will throw anOnErrorNotImplementedException ifonError is invoked.T - the observed value typeonNext - a function that handles each item emitted by anObservableSubscriber that callsonNext for each emitted item from theObservable theSubscriber subscribes tojava.lang.IllegalArgumentException - ifonNext isnullpublic static <T> Subscriber<T> create(Action1<? super T> onNext,Action1<java.lang.Throwable> onError)
Subscriber that receives the emissions of anyObservable it subscribes to viaonNext and handles anyonError notification but ignores anonCompleted notification.T - the observed value typeonNext - a function that handles each item emitted by anObservableonError - a function that handles an error notification if one is sent by anObservableSubscriber that callsonNext for each emitted item from theObservable theSubscriber subscribes to, and callsonError if theObservable notifies of an errorjava.lang.IllegalArgumentException - if eitheronNext oronError arenullpublic static <T> Subscriber<T> create(Action1<? super T> onNext,Action1<java.lang.Throwable> onError,Action0 onComplete)
Subscriber that receives the emissions of anyObservable it subscribes to viaonNext and handles anyonError oronCompleted notifications.T - the observed value typeonNext - a function that handles each item emitted by anObservableonError - a function that handles an error notification if one is sent by anObservableonComplete - a function that handles a sequence complete notification if one is sent by anObservableSubscriber that callsonNext for each emitted item from theObservable theSubscriber subscribes to, callsonError if theObservable notifies of an error, and callsonComplete if theObservable notifies that the observable sequence is completejava.lang.IllegalArgumentException - if eitheronNext,onError, oronComplete arenullpublic static <T> Subscriber<T> wrap(Subscriber<? super T> subscriber)
Subscriber that passes all events tosubscriber, has backpressure controlled bysubscriber and uses the subscription list ofsubscriber whenSubscriber.add(rx.Subscription) is called.T - the observed value typesubscriber - the Subscriber to wrap.subscriber, has backpressure controlled bysubscriber and usessubscriber to manage unsubscription.