MCPcopy Create free account
hub / github.com/diffplug/goomph / modifyFile

Method modifyFile

src/main/java/com/diffplug/gradle/FileMisc.java:259–263  ·  view source on GitHub ↗

Modifies the given file in place.

(File file, Function<String, String> modifier)

Source from the content-addressed store, hash-verified

257
258 /** Modifies the given file in place. */
259 public static void modifyFile(File file, Function<String, String> modifier) throws IOException {
260 String content = new String(Files.toByteArray(file), StandardCharsets.UTF_8);
261 String result = modifier.apply(content);
262 Files.write(result.getBytes(StandardCharsets.UTF_8), file);
263 }
264
265 /** Deletes the given file or directory if it exists, then creates a fresh directory in its place. */
266 public static void cleanDir(File dirToRemove) throws IOException {

Callers 1

writeBrandingPluginMethod · 0.95

Calls 2

applyMethod · 0.80
writeMethod · 0.45

Tested by

no test coverage detected