如何基于MongoDB Reactive Streams Java Driver的GridFSDownloadStream类创建Flux <databuffer>?

时间:2017-11-08 13:52:24

标签: spring mongodb mongodb-query reactive-programming project-reactor

MongoDB Reactive Streams Java驱动程序的 GridFSDownloadStream 类允许使用以下方法读取数据:

/**
 * Reads a sequence of bytes from this stream into the given buffer.
 *
 * @param dst      the destination buffer
 * @return a publisher with a single element, the total number of bytes read into the buffer, or
 *         {@code -1} if there is no more data because the end of the stream has been reached.
 */

Publisher<Integer> read(ByteBuffer dst);

是否有一种简单的方法来创建反应堆 Flux&lt; DataBuffer&gt; 基于此API?

我想用它来创建一个反应式REST响应。

0 个答案:

没有答案