Skip to content

Commit

Permalink
Revises combine method πŸ‘·β€β™€οΈ
Browse files Browse the repository at this point in the history
Renames variable `raf` to a proper, meaningful `randomAccessToPart`, and inlines single-use `channel` variable.

#233
  • Loading branch information
jakobvogel committed Sep 18, 2023
1 parent 7d6fd11 commit 633c464
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/main/java/ninja/S3Dispatcher.java
Original file line number Diff line number Diff line change
Expand Up @@ -1086,9 +1086,9 @@ private File combineParts(String id, String uploadId, List<File> parts) {

private void combine(List<File> parts, FileChannel out) throws IOException {
for (File part : parts) {
try (RandomAccessFile raf = new RandomAccessFile(part, "r")) {
FileChannel channel = raf.getChannel();
out.write(channel.map(FileChannel.MapMode.READ_ONLY, 0, raf.length()));
try (RandomAccessFile randomAccessToPart = new RandomAccessFile(part, "r")) {
out.write(randomAccessToPart.getChannel()
.map(FileChannel.MapMode.READ_ONLY, 0, randomAccessToPart.length()));
}
}
}
Expand Down

0 comments on commit 633c464

Please sign in to comment.