ibessonov commented on code in PR #2390:
URL: https://github.com/apache/ignite-3/pull/2390#discussion_r1298395817
##########
modules/file-transfer/src/main/java/org/apache/ignite/internal/network/file/ChunkedFileReader.java:
##########
@@ -88,18 +81,12 @@ byte[] readNextChunk() throws IOException {
throw new IOException("No more chunks to read");
}
- int toRead = (int) Math.min(chunkSize, length - offset);
- byte[] data = new byte[toRead];
- int read = stream.read(data);
-
- if (read != toRead) {
- throw new IOException("Failed to read chunk data from file:
expected " + toRead + ", actual " + read + "]");
- }
+ byte[] data = stream.readNBytes(chunkSize);
- offset += toRead;
nextChunkNumber++;
+ hasNextChunk = stream.available() > 0;
- if (offset == length) {
+ if (stream.available() == 0) {
Review Comment:
I wonder why it's not a `!hasNextChunk`, but whatever.
I've been looking at this code for too long. If there are more problems, I
probably won't notice them at this point
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]