Last active
March 29, 2020 09:57
-
-
Save eaiman-shoshi/a2122cf37624a1d2961f79551ebb86a0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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