RxIo emitter 操作符
emitter 操作符负责创建异步IO数据流,可由业务自己定义输出格式。
代码示例
@Test
public void testRxIoSimpleExecutor() throws Exception {
RxIo.emitter(new IoEmitter<String>() {
@Override
public String call() throws Exception {
return "This is From Executor-" + Thread.currentThread().getName();
}
}).subscribe(new IoSubscriber<String>() {
@Override
public void onNext(String value) throws Exception {
System.out.println(value);
}
@Override
public void onCompleted() {
System.err.println("----------------- 3." + Thread.currentThread() + " ----------------");
System.out.println("complete");
}
@Override
public void onError(Throwable cause) {
}
}).start();
}