public static BufferedWriter createWriter(String filename, String encoding, boolean append) throws IOException {
        createDirectory(filename);
        return new BufferedWriter(new OutputStreamWriter(new FileOutputStream(filename, append), encoding));
    }
Creates a buffered writer,
and the directories to contain it if they do not exist

@param filename the name or path of the file
@param encoding the encoding to use, for instance "UTF-8"
@param append whether to append to the files if it exists
vespajlib/src/main/java/com/yahoo/io/IOUtils.java