public void writeToFile(TranslatorManager delegator, Path codePath, String content, boolean overwriteExisting) { requireNonNulls(codePath, content); try { if (overwriteExisting || !codePath.toFile().exists()) { final Path hashPath = codePath.getParent() .resolve(secretFolderName()) .resolve(HASH_PREFIX + codePath.getFileName().toString() + HASH_SUFFIX); write(hashPath, HashUtil.md5(content), true); write(codePath, content, false); fileCounter.incrementAndGet(); } } catch (final IOException ex) { LOGGER.error(ex, "Failed to write file " + codePath); } LOGGER.trace("*** BEGIN File:" + codePath); Stream.of(content.split(Formatting.nl())).forEachOrdered(LOGGER::trace); LOGGER.trace("*** END File:" + codePath); }
public void writeToFile(TranslatorManager delegator, Path codePath, String content, boolean overwriteExisting) { requireNonNulls(codePath, content); try { if (overwriteExisting || !codePath.toFile().exists()) { final Path hashPath = codePath.getParent() .resolve(secretFolderName()) .resolve(HASH_PREFIX + codePath.getFileName().toString() + HASH_SUFFIX); write(hashPath, HashUtil.md5(content), true); write(codePath, content, false); fileCounter.incrementAndGet(); } } catch (final IOException ex) { LOGGER.error(ex, "Failed to write file " + codePath); } LOGGER.trace("*** BEGIN File:" + codePath); Stream.of(content.split(Formatting.nl())).forEachOrdered(LOGGER::trace); LOGGER.trace("*** END File:" + codePath); }