code: private static void write(CharSequence from, File to, Charset charset, boolean append)
        throws IOException {
      asCharSink(to, charset, modes(append)).write(from);
    }
docs: Private helper method. Writes a character sequence to a file, optionally appending.
  
  @param from the character sequence to append
  @param to the destination file
  @param charset the charset used to encode the output stream; see {@link StandardCharsets} for
  helpful predefined constants
  @param append true to append, false to overwrite
  @throws IOException if an I/O error occurs