1

After downloading the file through the controller, an error occurs in the service. There are 122 lines in the file, but it only reads 108. Has anyone encountered such a problem?

Debug vars

109 line

Fileparser code

Wizzy Ego
  • 13
  • 3

1 Answers1

0

In this method, the filePartFlux is directly passed from the controller layer. Then we flat map filePartFlux and get a new Flux stream. It may help you by using this code you can upload any file and get a string

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);
    }))