RxIo
RxIo copied to clipboard
May we use BodyPublishers.ofFile as a read alternative to asynchronousfilechannel
This looks to work fine:
Flow.Publisher<ByteBuffer> body = BodyPublishers.ofFile(metamorphosis);
Observable
.fromPublisher(FlowAdapters.toPublisher(body))
.take(10)
.map(buf -> new String(buf.array()))
.zipWith(Observable.interval(500, TimeUnit.MILLISECONDS), (item, interval) -> item)
.subscribe(str -> System.out.println(str));
System.out.println("Subscribed");