MCPcopy Create free account
hub / github.com/Whiley/WhileyCompiler / mirror

Method mirror

src/main/java/wycc/util/testing/TestManager.java:200–210  ·  view source on GitHub ↗

Mirror the contents of a given test state in a given directory. @param state @param dir @throws IOException

(Map<Trie, TextFile> state, Path dir)

Source from the content-addressed store, hash-verified

198 * @throws IOException
199 */
200 public static void mirror(Map<Trie, TextFile> state, Path dir) throws IOException {
201 for (Map.Entry<Trie, TextFile> e : state.entrySet()) {
202 Path p = dir.resolve(e.getKey().toPath());
203 TextFile f = e.getValue();
204 //
205 p.getParent().toFile().mkdirs();
206 try (FileOutputStream fout = new FileOutputStream(p.toFile())) {
207 fout.write(f.getBytes(StandardCharsets.US_ASCII));
208 }
209 }
210 }
211
212 /**
213 * Force a directory and all its contents to be deleted.

Callers 1

runMethod · 0.95

Calls 6

getBytesMethod · 0.95
resolveMethod · 0.80
toPathMethod · 0.80
getValueMethod · 0.65
getParentMethod · 0.65
writeMethod · 0.65

Tested by

no test coverage detected