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


Java Schedulers.io方法代码示例

本文整理汇总了Java中rx.schedulers.Schedulers.io方法的典型用法代码示例。如果您正苦于以下问题:Java Schedulers.io方法的具体用法?Java Schedulers.io怎么用?Java Schedulers.io使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在rx.schedulers.Schedulers的用法示例。


在下文中一共展示了Schedulers.io方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testUploadFileNotFoundException

import rx.schedulers.Schedulers; //导入方法依赖的package包/类
@Test
public void testUploadFileNotFoundException() throws Exception {
    final File file = new File("invalid");
    final String jobId = "job-id";
     final Job job = Job.builder()
            .setId(jobId)
            .setStatus(Status.createQueued(jobId))
            .setMetadata(Collections.emptyMap())
            .setFilepath("invalid")
            .setMimeType("text/plain")
            .build();

    final UploadService service = mock(UploadService.class);

    final Uploader uploader = new Uploader(service, Schedulers.io());
    final TestSubscriber<Status> ts = TestSubscriber.create();
    uploader.upload(job, file).subscribe(ts);

    ts.awaitTerminalEvent(1, TimeUnit.SECONDS);
    ts.assertError(FileNotFoundException.class);
    ts.assertNoValues();
}
 
开发者ID:jsaund,项目名称:RxUploader,代码行数:23,代码来源:UploaderTest.java

示例2: onCreate

import rx.schedulers.Schedulers; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_user_search);

    toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    progressBar = (ProgressBar) findViewById(R.id.progress_bar);
    textViewErrorMessage = (TextView) findViewById(R.id.text_view_error_msg);
    recyclerViewUsers = (RecyclerView) findViewById(R.id.recycler_view_users);
    usersAdapter = new UsersAdapter(null, this);
    recyclerViewUsers.setAdapter(usersAdapter);

    userSearchPresenter = new UserSearchPresenter(Injection.provideUserRepo(), Schedulers.io(),
            AndroidSchedulers.mainThread());
    userSearchPresenter.attachView(this);
}
 
开发者ID:moyheen,项目名称:github-user-search,代码行数:18,代码来源:UserSearchActivity.java

示例3: testUploadFailedUnhandledException

import rx.schedulers.Schedulers; //导入方法依赖的package包/类
@Test
public void testUploadFailedUnhandledException() throws Exception {
    final File file = getFile(TEST_FILE);
    final String jobId = "job-id";
    final Job job = Job.builder()
            .setId(jobId)
            .setStatus(Status.createQueued(jobId))
            .setMetadata(Collections.emptyMap())
            .setFilepath(file.getPath())
            .setMimeType("text/plain")
            .build();

    final UploadService service = mock(UploadService.class);
    when(service.upload(anyMap(), any(MultipartBody.Part.class)))
            .thenThrow(new RuntimeException(""));

    final Uploader uploader = new Uploader(service, Schedulers.io());
    final TestSubscriber<Status> ts = TestSubscriber.create();
    uploader.upload(job, file).subscribe(ts);

    ts.awaitTerminalEvent(1, TimeUnit.SECONDS);
    ts.assertError(RuntimeException.class);
    ts.assertNoValues();
}
 
开发者ID:jsaund,项目名称:RxUploader,代码行数:25,代码来源:UploaderTest.java

示例4: rx

import rx.schedulers.Schedulers; //导入方法依赖的package包/类
/**
 * The returned RxDao is a special DAO that let's you interact with Rx Observables using RX's IO scheduler for
 * subscribeOn.
 *
 * @see #rxPlain()
 */
@Experimental
public RxDao<T, K> rx() {
    if (rxDao == null) {
        rxDao = new RxDao<>(this, Schedulers.io());
    }
    return rxDao;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:14,代码来源:AbstractDao.java

示例5: rxTx

import rx.schedulers.Schedulers; //导入方法依赖的package包/类
/**
 * The returned {@link RxTransaction} allows DB transactions using Rx Observables using RX's IO scheduler for
 * subscribeOn.
 *
 * @see #rxTxPlain()
 */
@Experimental
public RxTransaction rxTx() {
    if (rxTxIo == null) {
        rxTxIo = new RxTransaction(this, Schedulers.io());
    }
    return rxTxIo;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:14,代码来源:AbstractDaoSession.java

示例6: onCreate

import rx.schedulers.Schedulers; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_make_up_search);

    progressBar = (ProgressBar) findViewById(R.id.progress_bar);
    textViewErrorMessage = (TextView) findViewById(R.id.text_view_error_msg);
    textViewEmptyMessage = (TextView) findViewById(R.id.textView_empty_in_here);
    textViewGoBackMessage = (TextView) findViewById(R.id.textView_go_back_and_search);
    recyclerViewMakeUp = (RecyclerView) findViewById(R.id.recycler_view_makeup);
    lottieAnimationView = (LottieAnimationView) findViewById(R.id.animation_view);

    StaggeredGridLayoutManager staggeredGridLayoutManager = new StaggeredGridLayoutManager(2,
            StaggeredGridLayoutManager.VERTICAL);


    makeUpSearchAdapter = new MakeUpSearchAdapter(null);
    recyclerViewMakeUp.setLayoutManager(staggeredGridLayoutManager);
    recyclerViewMakeUp.setAdapter(makeUpSearchAdapter);

    makeupSearchPresenter = new MakeUpSearchPresenter(Injection.provideUserRepo(), Schedulers.io(),
            AndroidSchedulers.mainThread());
    makeupSearchPresenter.attachView(this);

    String brand = getIntent().getStringExtra("brand_selected");
    String product = getIntent().getStringExtra("product_selected");

    makeupSearchPresenter.search(brand, product);
}
 
开发者ID:moyheen,项目名称:MakeUpSearch,代码行数:30,代码来源:MakeUpSearchActivity.java

示例7: provideSubscribeScheduler

import rx.schedulers.Schedulers; //导入方法依赖的package包/类
@Provides
@PerDataManager
Scheduler provideSubscribeScheduler() {
    return Schedulers.io();
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:6,代码来源:DataManagerModule.java

示例8: create

import rx.schedulers.Schedulers; //导入方法依赖的package包/类
@NonNull
static UploadInteractor create(@NonNull Uploader uploader, @NonNull UploadDataStore dataStore,
        @NonNull UploadErrorAdapter errorAdapter) {
    return new UploadInteractorImpl(uploader, dataStore, errorAdapter, Schedulers.io());
}
 
开发者ID:jsaund,项目名称:RxUploader,代码行数:6,代码来源:UploadInteractorImpl.java

示例9: io

import rx.schedulers.Schedulers; //导入方法依赖的package包/类
@Override
public Scheduler io() {
    return Schedulers.io();
}
 
开发者ID:alicanozkara,项目名称:PokemonCards,代码行数:5,代码来源:AppRxSchedulers.java

示例10: getSubscribeScheduler

import rx.schedulers.Schedulers; //导入方法依赖的package包/类
public Scheduler getSubscribeScheduler() {
    if (mScheduler == null) {
        mScheduler = Schedulers.io();
    }
    return mScheduler;
}
 
开发者ID:derohimat,项目名称:SgPSI,代码行数:7,代码来源:BaseApplication.java

示例11: testUpload

import rx.schedulers.Schedulers; //导入方法依赖的package包/类
@Test
public void testUpload() throws Exception {
    final File file = getFile(TEST_FILE);
    final String jobId = "job-id";
    final Job job = Job.builder()
            .setId(jobId)
            .setStatus(Status.createQueued(jobId))
            .setMetadata(Collections.emptyMap())
            .setFilepath(file.getPath())
            .setMimeType("text/plain")
            .build();

    final BufferedSink sink = mock(BufferedSink.class);

    final List<Status> values = new ArrayList<>();
    values.add(Status.createSending(jobId, 0));

    final long total = file.length();
    long consumed = 0;
    while (consumed < total) {
        consumed = Math.min(total, consumed + RxRequestBody.BUFFER_SIZE);
        values.add(Status.createSending(jobId, (int) ((float) consumed * 100 / total)));
    }
    values.add(Status.createCompleted(jobId, "complete"));

    final Status[] expectedStatus = new Status[values.size()];
    values.toArray(expectedStatus);

    final UploadService service = (__, data) -> {
        try {
            data.body().writeTo(sink);
        } catch (@NonNull IOException e) {
            Single.error(e);
        }
        return Single.just("complete");
    };

    final Uploader uploader = new Uploader(service, Schedulers.io());
    final TestSubscriber<Status> ts = TestSubscriber.create();
    uploader.upload(job, file).subscribe(ts);

    ts.awaitTerminalEvent(1, TimeUnit.SECONDS);
    ts.assertNoErrors();
    ts.assertValues(expectedStatus);
}
 
开发者ID:jsaund,项目名称:RxUploader,代码行数:46,代码来源:UploaderTest.java

示例12: bindGeraltWomenUpdateCommand

import rx.schedulers.Schedulers; //导入方法依赖的package包/类
@Provides
@IntoMap
@CommandKey(GeraltWomenUpdateCommandRequest.class)
static CommandWithScheduler bindGeraltWomenUpdateCommand(final Provider<GeraltWomenUpdateCommand> provider) {
    return new CommandWithScheduler<>(provider, Schedulers.io());
}
 
开发者ID:dmitrikudrenko,项目名称:MDRXL,代码行数:7,代码来源:CommandModule.java

示例13: bindGeraltWomanUpdateCommand

import rx.schedulers.Schedulers; //导入方法依赖的package包/类
@Provides
@IntoMap
@CommandKey(GeraltWomanUpdateCommandRequest.class)
static CommandWithScheduler bindGeraltWomanUpdateCommand(final Provider<GeraltWomanUpdateCommand> provider) {
    return new CommandWithScheduler<>(provider, Schedulers.io());
}
 
开发者ID:dmitrikudrenko,项目名称:MDRXL,代码行数:7,代码来源:CommandModule.java

示例14: provideScheduler

import rx.schedulers.Schedulers; //导入方法依赖的package包/类
@NetworkScheduler
@Provides
public Scheduler provideScheduler() {
    return Schedulers.io();
}
 
开发者ID:dmitrikudrenko,项目名称:MDRXL,代码行数:6,代码来源:NetworkModule.java

示例15: getIoScheduler

import rx.schedulers.Schedulers; //导入方法依赖的package包/类
@NonNull
@Override
public Scheduler getIoScheduler() {
    return Schedulers.io();
}
 
开发者ID:ehsunshine,项目名称:memory-game,代码行数:6,代码来源:DefaultSchedulerProvider.java


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