in src/main/java/org/apache/datasketches/Files.java [1023:1040]
public static void appendStringToFile(final String text, final String fileName,
final int bufSize, final Charset charset) {
checkFileName(fileName);
final File file = new File(fileName);
if (!file.isFile()) { // does not exist
try {
file.createNewFile();
} catch (final Exception e) {
throw new RuntimeException("Cannot create file: " + fileName + LS + e);
}
}
try (BufferedWriter bw = openBufferedWriter(file, bufSize, true, charset);
PrintWriter out = new PrintWriter(bw);) {
out.print(text);
} catch (final IOException e) {
throw new RuntimeException(e);
}
}