Changeset 9280 in josm for trunk/src/org/openstreetmap/josm/plugins/PluginDownloadTask.java
- Timestamp:
- 2016-01-03T16:30:55+01:00 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/plugins/PluginDownloadTask.java
r9168 r9280 6 6 import java.awt.Component; 7 7 import java.io.File; 8 import java.io.FileOutputStream;9 8 import java.io.IOException; 10 9 import java.io.InputStream; 11 import java.io.OutputStream;12 10 import java.net.MalformedURLException; 13 11 import java.net.URL; 12 import java.nio.file.Files; 13 import java.nio.file.StandardCopyOption; 14 14 import java.util.Collection; 15 15 import java.util.LinkedList; … … 127 127 .connect(); 128 128 } 129 try ( 130 InputStream in = downloadConnection.getContent(); 131 OutputStream out = new FileOutputStream(file) 132 ) { 133 byte[] buffer = new byte[8192]; 134 for (int read = in.read(buffer); read != -1; read = in.read(buffer)) { 135 out.write(buffer, 0, read); 136 } 129 try (InputStream in = downloadConnection.getContent()) { 130 Files.copy(in, file.toPath(), StandardCopyOption.REPLACE_EXISTING); 137 131 } 138 132 } catch (MalformedURLException e) {
Note:
See TracChangeset
for help on using the changeset viewer.