Package com.forgerock.reactive
Class RxJavaStreams
- java.lang.Object
-
- com.forgerock.reactive.RxJavaStreams
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static CompletablecompletableError(Throwable error)Create a newCompletablefrom the given error.static <V> Stream<V>emptyStream()Create a new emptyStream.static CompletablenewCompletable(Completable.Emitter onSubscribe)Creates a bridge from callback world toCompletable.static <V> Single<V>newSingle(Single.Emitter<V> emitter)Creates a bridge from callback world toSingle.static <V> Single<V>singleError(Throwable error)Create a newSinglefrom the given error.static <V> Single<V>singleFrom(V value)Create a newSinglefrom the given value.static <V> Single<V>singleFromPublisher(org.reactivestreams.Publisher<V> publisher)Create a newSinglefrom the givenPublisher.static <V> Stream<V>streamError(Throwable error)Create a newStreamcomposed only of the given error.static <V> Stream<V>streamFrom(V value)Create a newStreamcomposed only of the given value.static <V> Stream<V>streamFromPublisher(org.reactivestreams.Publisher<V> publisher)Create a newStreamfrom the givenPublisher.
-
-
-
Method Detail
-
streamFromPublisher
public static <V> Stream<V> streamFromPublisher(org.reactivestreams.Publisher<V> publisher)
Create a newStreamfrom the givenPublisher.- Type Parameters:
V- Type of data emitted- Parameters:
publisher- ThePublisherto convert- Returns:
- A new
Stream
-
streamFrom
public static <V> Stream<V> streamFrom(V value)
Create a newStreamcomposed only of the given value.- Type Parameters:
V- Type of data emitted- Parameters:
value- The value emitted by this stream- Returns:
- A new
Stream
-
streamError
public static <V> Stream<V> streamError(Throwable error)
Create a newStreamcomposed only of the given error.- Type Parameters:
V- Type of data emitted- Parameters:
error- The error emitted by this stream- Returns:
- A new
Stream
-
emptyStream
public static <V> Stream<V> emptyStream()
Create a new emptyStream.- Type Parameters:
V- Type of data emitted- Returns:
- An empty
Stream
-
singleFromPublisher
public static <V> Single<V> singleFromPublisher(org.reactivestreams.Publisher<V> publisher)
Create a newSinglefrom the givenPublisher. If thePublisherproduce more than one result, they'll be dropped and the innerSubscriptioncancelled.- Type Parameters:
V- Type of the datum emitted- Parameters:
publisher- ThePublisherto convert- Returns:
- A new
Stream
-
singleFrom
public static <V> Single<V> singleFrom(V value)
Create a newSinglefrom the given value.
-
singleError
public static <V> Single<V> singleError(Throwable error)
Create a newSinglefrom the given error.
-
newSingle
public static <V> Single<V> newSingle(Single.Emitter<V> emitter)
Creates a bridge from callback world toSingle.
-
newCompletable
public static Completable newCompletable(Completable.Emitter onSubscribe)
Creates a bridge from callback world toCompletable.- Parameters:
onSubscribe- Action to perform once thisCompletablehas been subscribed to.- Returns:
- A new
Completable
-
completableError
public static Completable completableError(Throwable error)
Create a newCompletablefrom the given error.- Parameters:
error- The error emitted by thisCompletable- Returns:
- A new
Completable
-
-