code: public static BufferedWriter newWriter(File file, Charset charset) throws FileNotFoundException {
      checkNotNull(file);
      checkNotNull(charset);
      return new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file), charset));
    }
docs: Returns a buffered writer that writes to a file using the given character set.
  
  @param file the file to write to
  @param charset the charset used to encode the output stream; see {@link StandardCharsets} for
  helpful predefined constants
  @return the buffered writer