本文整理汇总了Java中io.reactivex.Observable.toFlowable方法的典型用法代码示例。如果您正苦于以下问题:Java Observable.toFlowable方法的具体用法?Java Observable.toFlowable怎么用?Java Observable.toFlowable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类io.reactivex.Observable
的用法示例。
在下文中一共展示了Observable.toFlowable方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: adapt
import io.reactivex.Observable; //导入方法依赖的package包/类
@Override public Object adapt(Call<R> call) {
Observable<Response<R>> responseObservable = isAsync
? new CallEnqueueObservable<>(call)
: new CallExecuteObservable<>(call);
Observable<?> observable;
if (isResult) {
observable = new ResultObservable<>(responseObservable);
} else if (isBody) {
observable = new BodyObservable<>(responseObservable);
} else {
observable = responseObservable;
}
if (scheduler != null) {
observable = observable.subscribeOn(scheduler);
}
if (isFlowable) {
return observable.toFlowable(BackpressureStrategy.LATEST);
}
if (isSingle) {
return observable.singleOrError();
}
if (isMaybe) {
return observable.singleElement();
}
if (isCompletable) {
return observable.ignoreElements();
}
return observable;
}
示例2: adapt
import io.reactivex.Observable; //导入方法依赖的package包/类
@Override public Object adapt(Call<R> call) {
if (call.request().body() == null) {
throw new IllegalStateException("can't execute requestbody progress task, specify request not exist requestbody: " + call.request());
}
Observable<ProgressBean<Response<R>>> responseObservable = isAsync
? new CallEnqueueWithProgressObservable<>(call)
: new CallExecuteWithProgressObservable<>(call);
Observable<?> observable;
if (isResult) {
observable = new ResultWithProgressObservable<>(responseObservable);
} else if (isBody) {
observable = new BodyWithProgressObservable<>(responseObservable);
} else {
observable = responseObservable;
}
if (scheduler != null) {
observable = observable.subscribeOn(scheduler);
}
if (isFlowable) {
return observable.toFlowable(BackpressureStrategy.LATEST);
}
if (isSingle) {
return observable.singleOrError();
}
if (isMaybe) {
return observable.singleElement();
}
if (isCompletable) {
return observable.ignoreElements();
}
return observable;
}
开发者ID:imfms,项目名称:retrofit-rxjava-request-with-progress,代码行数:38,代码来源:RxJava2WithProgressCallAdapter.java
示例3: adapt
import io.reactivex.Observable; //导入方法依赖的package包/类
@Override
public Object adapt(Call<R> call) {
Observable<Response<R>> responseObservable = new CallObservable<>(call);
Observable<?> observable;
if (isResult) {
observable = new ResultObservable<>(responseObservable);
} else if (isBody) {
observable = new BodyObservable<>(responseObservable);
} else {
observable = responseObservable;
}
if (scheduler != null) {
observable = observable.subscribeOn(scheduler);
}
if (isFlowable) {
return observable.toFlowable(BackpressureStrategy.LATEST);
}
if (isSingle) {
return observable.singleOrError();
}
if (isMaybe) {
return observable.singleElement();
}
if (isCompletable) {
return observable.ignoreElements();
}
return observable;
}