MCPcopy Index your code
hub / github.com/benfry/processing4 / copyFile

Method copyFile

app/src/processing/app/Util.java:164–184  ·  view source on GitHub ↗
(File sourceFile,
                              File targetFile)

Source from the content-addressed store, hash-verified

162
163
164 static public void copyFile(File sourceFile,
165 File targetFile) throws IOException {
166 BufferedInputStream from =
167 new BufferedInputStream(new FileInputStream(sourceFile));
168 BufferedOutputStream to =
169 new BufferedOutputStream(new FileOutputStream(targetFile));
170 byte[] buffer = new byte[16 * 1024];
171 int bytesRead;
172 while ((bytesRead = from.read(buffer)) != -1) {
173 to.write(buffer, 0, bytesRead);
174 }
175 from.close();
176
177 to.flush();
178 to.close();
179
180 //noinspection ResultOfMethodCallIgnored
181 targetFile.setLastModified(sourceFile.lastModified());
182 //noinspection ResultOfMethodCallIgnored
183 targetFile.setExecutable(sourceFile.canExecute());
184 }
185
186
187 /**

Callers 4

copyDirMethod · 0.95
moveLikeSketchFolderMethod · 0.95
addFileMethod · 0.95
exportApplicationMethod · 0.95

Calls 5

setLastModifiedMethod · 0.80
writeMethod · 0.65
readMethod · 0.45
closeMethod · 0.45
flushMethod · 0.45

Tested by

no test coverage detected