code: public static BufferedWriter newWriter(Path self, String charset, boolean append) throws IOException {
          if (append) {
              return Files.newBufferedWriter(self, Charset.forName(charset), CREATE, APPEND);
          }
          return Files.newBufferedWriter(self, Charset.forName(charset));
      }
docs: Helper method to create a buffered writer for a file.  If the given
  charset is "UTF-16BE" or "UTF-16LE", the requisite byte order mark is
  written to the stream before the writer is returned.
  
  @param self    a Path
  @param charset the name of the encoding used to write in this file
  @param append  true if in append mode
  @return a BufferedWriter
  @throws java.io.IOException if an IOException occurs.
  @since 2.3.0