当前位置: 首页>>代码示例>>Java>>正文


Java Observable.toFlowable方法代码示例

本文整理汇总了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;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:33,代码来源:RxJava2CallAdapter.java

示例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;
}
 
开发者ID:octaware,项目名称:super-volley,代码行数:32,代码来源:RxJava2CallAdapter.java


注:本文中的io.reactivex.Observable.toFlowable方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。