public final class Subscribers
extends java.lang.Object
Subscriber objects.| Modifier and Type | Method and Description |
|---|---|
static <T> Subscriber<T> |
create(Action1<? super T> onNext)
Creates a
Subscriber that receives the emissions of any Observable it subscribes to via
onNext but ignores onCompleted notifications;
it will throw an OnErrorNotImplementedException if onError is invoked. |
static <T> Subscriber<T> |
create(Action1<? super T> onNext,
Action1<java.lang.Throwable> onError)
Creates an
Subscriber that receives the emissions of any Observable it subscribes to via
onNext and handles any onError notification but
ignores an onCompleted 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 any Observable it subscribes to via
onNext and handles any onError or
onCompleted notifications. |
static <T> Subscriber<T> |
empty()
Returns an inert
Subscriber that does nothing in response to the emissions or notifications
from any Observable it subscribes to. |
static <T> Subscriber<T> |
from(Observer<? super T> o)
Converts an
Observer into a Subscriber. |
static <T> Subscriber<T> |
wrap(Subscriber<? super T> subscriber)
Returns a new
Subscriber that passes all events to
subscriber, has backpressure controlled by
subscriber and uses the subscription list of
subscriber when Subscriber.add(rx.Subscription) is
called. |
public static <T> Subscriber<T> empty()
Subscriber that does nothing in response to the emissions or notifications
from any Observable it subscribes to. Will throw an OnErrorNotImplementedException if onError
method is calledObserverpublic static <T> Subscriber<T> from(Observer<? super T> o)
Observer into a Subscriber.o - the Observer to convertSubscriber version of opublic static <T> Subscriber<T> create(Action1<? super T> onNext)
Subscriber that receives the emissions of any Observable it subscribes to via
onNext but ignores onCompleted notifications;
it will throw an OnErrorNotImplementedException if onError is invoked.onNext - a function that handles each item emitted by an ObservableSubscriber that calls onNext for each emitted item from the Observable
the Subscriber subscribes toIllegalArgument - Exception
if onNext is nullpublic static <T> Subscriber<T> create(Action1<? super T> onNext, Action1<java.lang.Throwable> onError)
Subscriber that receives the emissions of any Observable it subscribes to via
onNext and handles any onError notification but
ignores an onCompleted notification.onNext - a function that handles each item emitted by an ObservableonError - a function that handles an error notification if one is sent by an ObservableSubscriber that calls onNext for each emitted item from the Observable
the Subscriber subscribes to, and calls onError if the Observable
notifies of an errorIllegalArgument - Exception
if either onNext or onError are nullpublic static <T> Subscriber<T> create(Action1<? super T> onNext, Action1<java.lang.Throwable> onError, Action0 onComplete)
Subscriber that receives the emissions of any Observable it subscribes to via
onNext and handles any onError or
onCompleted notifications.onNext - a function that handles each item emitted by an ObservableonError - a function that handles an error notification if one is sent by an ObservableonComplete - a function that handles a sequence complete notification if one is sent by an ObservableSubscriber that calls onNext for each emitted item from the Observable
the Subscriber subscribes to, calls onError if the Observable notifies
of an error, and calls onComplete if the Observable notifies that the observable
sequence is completeIllegalArgument - Exception
if either onNext, onError, or onComplete are nullpublic static <T> Subscriber<T> wrap(Subscriber<? super T> subscriber)
Subscriber that passes all events to
subscriber, has backpressure controlled by
subscriber and uses the subscription list of
subscriber when Subscriber.add(rx.Subscription) is
called.subscriber - the Subscriber to wrap.subscriber, has backpressure controlled by
subscriber and uses subscriber to
manage unsubscription.