< prev index next >
src/jdk.jpackage/share/classes/jdk/jpackage/internal/IOUtils.java
Print this page
@@ -119,35 +119,10 @@
return FileVisitResult.CONTINUE;
}
});
}
- public static void copyFromURL(URL location, File file) throws IOException {
- copyFromURL(location, file, false);
- }
-
- public static void copyFromURL(URL location, File file, boolean append)
- throws IOException {
- if (location == null) {
- throw new IOException("Missing input resource!");
- }
- if (file.exists() && !append) {
- file.delete();
- }
- try (InputStream in = location.openStream();
- FileOutputStream out = new FileOutputStream(file, append)) {
-
- byte[] buffer = new byte[1024];
- int len;
- while ((len = in.read(buffer)) != -1) {
- out.write(buffer, 0, len);
- }
- }
- file.setReadOnly();
- file.setReadable(true, false);
- }
-
public static void copyFile(File sourceFile, File destFile)
throws IOException {
destFile.getParentFile().mkdirs();
//recreate the file as existing copy may have weird permissions
< prev index next >