How to convert Reactor Flux<String> to InputStream
问题 Given that I have a Flux<String> of unknown size, how can I convert it into InputStream that other library is expecting? For example with WebClient I can achieve that using this approach WebClient.get('example.com').exchange.flatMap { it.bodyToMono(InputStreamResource::class.java) }.map { it.inputStream } but I can't figure out how to do the same when I have Flux<String> as an input? 回答1: There are probably many ways to do this. One possibility is to use PipedInputStream and PipedOutputStream