Skip to content
Advertisement

Convert Flux into Flux

I am working on spring webflux file upload. From the controller I want to upload the file on amazon S3 bucket. So in the controller I received following object

JavaScript

And from the FilePart.content() I can get

JavaScript

My question is how can I convert this Flux<DataBuffer> into Flux<ByteBuffer>. I mean into the following object

JavaScript

Advertisement

Answer

You can simply use the org.springframework.core.io.buffer.DataBuffer#asByteBuffer():

JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement