Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
public Flux<String> getLines(Flux<FilePart> filePartFlux) {
return filePartFlux.flatMap(filePart ->
filePart.content().map(dataBuffer -> {
byte[] bytes = new byte[dataBuffer.readableByteCount()];
dataBuffer.read(bytes);
DataBufferUtils.release(dataBuffer);
return new String(bytes, StandardCharsets.UTF_8);
})
.map(this::processAndGetLinesAsList)
.flatMapIterable(Function.identity());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment