本文整理汇总了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();
}
示例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);
}
示例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();
}
示例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;
}
示例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;
}
示例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);
}
示例7: provideSubscribeScheduler
import rx.schedulers.Schedulers; //导入方法依赖的package包/类
@Provides
@PerDataManager
Scheduler provideSubscribeScheduler() {
return Schedulers.io();
}
示例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());
}
示例9: io
import rx.schedulers.Schedulers; //导入方法依赖的package包/类
@Override
public Scheduler io() {
return Schedulers.io();
}
示例10: getSubscribeScheduler
import rx.schedulers.Schedulers; //导入方法依赖的package包/类
public Scheduler getSubscribeScheduler() {
if (mScheduler == null) {
mScheduler = Schedulers.io();
}
return mScheduler;
}
示例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);
}
示例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());
}
示例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());
}
示例14: provideScheduler
import rx.schedulers.Schedulers; //导入方法依赖的package包/类
@NetworkScheduler
@Provides
public Scheduler provideScheduler() {
return Schedulers.io();
}
示例15: getIoScheduler
import rx.schedulers.Schedulers; //导入方法依赖的package包/类
@NonNull
@Override
public Scheduler getIoScheduler() {
return Schedulers.io();
}