-
public final class SubscribersHelper methods and utilities for creating and working with Subscriber objects.
-
-
Method Summary
Modifier and Type Method Description static <T> Subscriber<T>empty()Returns an inert Subscriber that does nothing in response to the emissions or notificationsfrom any {@code Observable}it subscribes to.static <T> Subscriber<T>from(Observer<out Object> o)Converts an Observer into a Subscriber. static <T> Subscriber<T>create(Action1<out Object> onNext)Creates a Subscriber that receives the emissions of any {@code 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<out Object> onNext, Action1<Throwable> onError)Creates an Subscriber that receives the emissions of any {@code Observable}it subscribes to via onNext and handles any onError notification butignores an onCompleted notification.static <T> Subscriber<T>create(Action1<out Object> onNext, Action1<Throwable> onError, Action0 onComplete)Creates an Subscriber that receives the emissions of any {@code Observable}it subscribes to via onNext and handles any onError or onCompleted notifications.static <T> Subscriber<T>wrap(Subscriber<out Object> subscriber)Returns a new Subscriber that passes all events to subscriber, has backpressure controlled bysubscriberand uses the subscription list ofcalled.-
-
Method Detail
-
empty
static <T> Subscriber<T> empty()
Returns an inert Subscriber that does nothing in response to the emissions or notificationsfrom any
{@code Observable}it subscribes to. Will throw an OnErrorNotImplementedException if onError method is called
-
from
static <T> Subscriber<T> from(Observer<out Object> o)
Converts an Observer into a Subscriber.
- Parameters:
o- the Observer to convert
-
create
static <T> Subscriber<T> create(Action1<out Object> onNext)
Creates a Subscriber that receives the emissions of any
{@code Observable}it subscribes to via onNext but ignores onCompleted notifications;it will throw an OnErrorNotImplementedException if onError is invoked.- Parameters:
onNext- a function that handles each item emitted by an{@code Observable}
-
create
static <T> Subscriber<T> create(Action1<out Object> onNext, Action1<Throwable> onError)
Creates an Subscriber that receives the emissions of any
{@code Observable}it subscribes to via onNext and handles any onError notification butignores an onCompleted notification.- Parameters:
onNext- a function that handles each item emitted by an{@code Observable}onError- a function that handles an error notification if one is sent by an{@code Observable}
-
create
static <T> Subscriber<T> create(Action1<out Object> onNext, Action1<Throwable> onError, Action0 onComplete)
Creates an Subscriber that receives the emissions of any
{@code Observable}it subscribes to via onNext and handles any onError or onCompleted notifications.- Parameters:
onNext- a function that handles each item emitted by an{@code Observable}onError- a function that handles an error notification if one is sent by an{@code Observable}onComplete- a function that handles a sequence complete notification if one is sent by an{@code Observable}
-
wrap
static <T> Subscriber<T> wrap(Subscriber<out Object> subscriber)
Returns a new Subscriber that passes all events to
subscriber, has backpressure controlled bysubscriberand uses the subscription list ofcalled.- Parameters:
subscriber- the Subscriber to wrap.
-
-
-
-