in src/main/java/org/apache/datasketches/Files.java [559:577]
public static int appendStringToFileNIO(final String text, final String fileName,
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);
}
}
int bytes = 0;
try (FileChannel fc = openRandomAccessFile(file, "rw").getChannel()) {
bytes = append(text, fc, charset);
} catch (final IOException e) {
throw new RuntimeException("Cannot create File Channel: " + fileName + LS + e);
}
return bytes;
}