(File from, File to)
| 131 | } |
| 132 | |
| 133 | private static void copyFile(File from, File to) throws IOException { |
| 134 | try (OutputStream out = new FileOutputStream(to)) { |
| 135 | final long copied = Files.copy(from.toPath(), out); |
| 136 | final long length = from.length(); |
| 137 | if (copied != length) { |
| 138 | throw new IOException("Could not transfer all bytes from " + from + " to " + to); |
| 139 | } |
| 140 | } |
| 141 | } |
| 142 | } |