1

How can an org.reactivestreams.Publisher<ByteBuffer> be created from a java.io.InputStream?

Context: I am using the awssdk to create an AsyncRequestBody, I have an InputStream and am therefore trying to use the AsyncRequestBody.fromPublisher method since none of the other "from" methods match.

There is a similar question but it seems like the true issue in that question is related to mongo (based on the answer); my question is a broader reactive streams issue.

Thank you in advance for your consideration and response.

Ramón J Romero y Vigil
  • 17,373
  • 7
  • 77
  • 125
  • You should be able to use something like Akka Streams' StreamConverters (https://doc.akka.io/api/akka/current/akka/stream/scaladsl/StreamConverters$.html#fromInputStream(in:()=%3Ejava.io.InputStream,chunkSize:Int):akka.stream.scaladsl.Source[akka.util.ByteString,scala.concurrent.Future[akka.stream.IOResult]]) + `.map(_.asByteBuffer).runWith(Sink.asPublisher))` – Viktor Klang Apr 20 '21 at 18:36

0 Answers0