public static void stringToFile(final String string, final Path file, final Charset charset) {
        try {
            if (Files.isRegularFile(file)) {
                FileUtil.deleteFile(file);
            }
            Files.createDirectories(file.getParent());
            Files.write(file, string.getBytes(charset));
        } catch (final IOException ioEx) {
            // Wrap it
            throw new RuntimeException(ioEx);
        }
    }
Takes a string and writes it to a file.
stroom-legacy/stroom-legacy-model_6_1/src/main/java/stroom/legacy/model_6_1/StreamUtil.java