Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -86,19 +86,11 @@ static public void copyFile(String source, String target) throws IOException {
throw new RuntimeException("failed to create target file.");
}

FileChannel sc = null;
FileChannel tc = null;
try {
tc = new FileOutputStream(tf).getChannel();
sc = new FileInputStream(sf).getChannel();
try (FileInputStream fis = new FileInputStream(sf);
FileOutputStream fos = new FileOutputStream(tf);
FileChannel sc = fis.getChannel();
FileChannel tc = fos.getChannel()) {
sc.transferTo(0, sc.size(), tc);
} finally {
if (null != sc) {
sc.close();
}
if (null != tc) {
tc.close();
}
}
}

Expand Down