MCPcopy Create free account
hub / github.com/Card-Forge/forge / copyFile

Method copyFile

forge-core/src/main/java/forge/util/FileUtil.java:109–124  ·  view source on GitHub ↗
(String sourceFilename, String destFilename)

Source from the content-addressed store, hash-verified

107 }
108
109 public static void copyFile(String sourceFilename, String destFilename) {
110 File source = new File(sourceFilename);
111 if (!source.exists()) { return; } //if source doesn't exist, nothing to copy
112
113 try (InputStream is = Files.newInputStream(source.toPath());
114 OutputStream os = Files.newOutputStream(new File(destFilename).toPath())){
115 byte[] buffer = new byte[1024];
116 int length;
117 while ((length = is.read(buffer)) > 0) {
118 os.write(buffer, 0, length);
119 }
120 }
121 catch (Exception e) {
122 e.printStackTrace();
123 }
124 }
125
126 public static void writeFile(String filename, String text) {
127 FileUtil.writeFile(new File(filename), text);

Callers 1

saveDataMethod · 0.95

Calls 2

writeMethod · 0.65
readMethod · 0.45

Tested by

no test coverage detected