Skip to content

Commit 06d925e

Browse files
authored
Merge pull request eugenp#5621 from holgerl/patch-1
FileOutputStream is never closed
2 parents b6e0928 + 770b28f commit 06d925e

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

‎core-java-io/src/main/java/com/baeldung/download/FileDownload.java‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ public static void downloadWithJavaNIO(String fileURL, String localFilename) thr
4545
FileOutputStream fileOutputStream = new FileOutputStream(localFilename); FileChannel fileChannel = fileOutputStream.getChannel()) {
4646

4747
fileChannel.transferFrom(readableByteChannel, 0, Long.MAX_VALUE);
48+
fileOutputStream.close();
4849
}
4950
}
5051

0 commit comments

Comments
 (0)