以前,我可以存储 基数64 图像使用 网格模板
val imageBytes = javax.xml.bind.DatatypeConverter.parseBase64Binary("base64 image string") gridFsTemplate.store(ByteArrayInputStream(imageBytes), "imagename")
然而 存储() 反应网格模板 接受类型为的参数 Flux<DataBuffer> . 如何将base64映像转换为该类型?
Flux<DataBuffer>
我相信您可以使用AsyncStreamHelper.toAsyncInputStream和base64作为字节数组。
我现在在打电话,所以我不能写一个例子,但是你可以在这里检查类的第二个最后的方法: https://github.com/BayviewComputerClub/smoothie-web/blob/master/src/main/java/club/bayview/smoothieweb/repositories/TestDataRepository.java