We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent da70d15 commit 3597aefCopy full SHA for 3597aef
1 file changed
net/channel/DownloadFileEx.java
@@ -15,10 +15,14 @@ public static void main(String[] args) throws IOException {
15
var myUrl = new URL(remoteFileName);
16
17
try (var rbc = Channels.newChannel(myUrl.openStream())) {
18
- try (var fos = new FileOutputStream(localFileName)) {
19
20
- fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
+ try (var fos = new FileOutputStream(localFileName);
+ var fch = fos.getChannel()) {
21
+
22
+ fch.transferFrom(rbc, 0, Long.MAX_VALUE);
23
}
24
25
26
27
28
0 commit comments