本文整理汇总了Java中io.reactivex.Flowable.fromPublisher方法的典型用法代码示例。如果您正苦于以下问题:Java Flowable.fromPublisher方法的具体用法?Java Flowable.fromPublisher怎么用?Java Flowable.fromPublisher使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类io.reactivex.Flowable
的用法示例。
在下文中一共展示了Flowable.fromPublisher方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createFlattenedStream
import io.reactivex.Flowable; //导入方法依赖的package包/类
private <T> ErrorStreamPair<T> createFlattenedStream(FlattenedStreamId<T> id, DiscoveryService discoveryService) {
Flowable<? extends Iterable<? extends T>> sourceStream = Flowable.fromPublisher(discoveryService.discover(id.sourceStreamId()));
return ErrorStreamPair.ofData(sourceStream.flatMap(iterable -> {
Stream<? extends T> stream = StreamSupport.stream(iterable.spliterator(), false).filter(Objects::nonNull);
return Flowable.fromIterable(stream.collect(Collectors.toList()));
}));
}
示例2: createDerivedStream
import io.reactivex.Flowable; //导入方法依赖的package包/类
private <S, T> ErrorStreamPair<T> createDerivedStream(DerivedStreamId<S, T> id, DiscoveryService discoveryService) {
Flowable<S> sourceStream = Flowable.fromPublisher(discoveryService.discover(id.sourceStreamId()));
Function<S, T> conversion = id.conversion();
ErrorDeflector ed = ErrorDeflector.create();
return ed.streamNonEmpty(sourceStream.map(ed.emptyOnException(conversion)));
}
示例3: combineWithLatestStream
import io.reactivex.Flowable; //导入方法依赖的package包/类
private <T, D, Y> Publisher<Y> combineWithLatestStream(CombineWithLatestStreamId<T, D, Y> streamId,
DiscoveryService discoveryService) {
Flowable<D> data = Flowable.fromPublisher(discoveryService.discover(streamId.dataStream()));
Flowable<T> trigger = Flowable.fromPublisher(discoveryService.discover(streamId.triggerStream()));
return trigger.withLatestFrom(data, streamId.combiner()::apply);
}
示例4: onCreate
import io.reactivex.Flowable; //导入方法依赖的package包/类
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
LiveData<List<Dog>> dogs = monarchy.findAllMappedWithChanges(realm -> realm.where(RealmDog.class),
from -> Dog.create(from.getName()));
this.dogs = Flowable.fromPublisher(LiveDataReactiveStreams.toPublisher(getActivity(), dogs));
}
示例5: rxFrom
import io.reactivex.Flowable; //导入方法依赖的package包/类
default <T> Flowable<T> rxFrom(StreamId<T> id) {
return Flowable.fromPublisher(discover(id));
}
示例6: rxFrom
import io.reactivex.Flowable; //导入方法依赖的package包/类
/**
* @deprecated rxjava2 has {@link Flowable#fromPublisher(Publisher)}
*/
public static <T> Flowable<T> rxFrom(Publisher<T> stream) {
return Flowable.fromPublisher(stream);
}
示例7: flowable
import io.reactivex.Flowable; //导入方法依赖的package包/类
@Override
public Flowable<T> flowable() {
return Flowable.fromPublisher(get());
}
示例8: play
import io.reactivex.Flowable; //导入方法依赖的package包/类
public Flowable<T> play(PlayOptions options){
return Flowable.fromPublisher(reactivePlayer.play(options));
}
示例9: DataStreamImpl
import io.reactivex.Flowable; //导入方法依赖的package包/类
public DataStreamImpl(List<DataStream> upstreams, Publisher<Data<T>> flow) {
Objects.requireNonNull(flow, "The flow passed to the stream cannot be `null`");
this.flow = Flowable.fromPublisher(flow);
this.upstreams = Collections.unmodifiableList(upstreams);
this.connectable = false;
}
示例10: adoptFluxToRxJava2Flowable
import io.reactivex.Flowable; //导入方法依赖的package包/类
@Test
public void adoptFluxToRxJava2Flowable() throws Exception {
Flux<String> people = Flux.just("Jesse", "Hank");
Flowable<String> flowable = Flowable.fromPublisher(people);
flowable.test().await().assertResult("Jesse", "Hank").awaitTerminalEvent();
}