code: public static void append(Path self, Object text, String charset, boolean writeBom) throws IOException {
          Writer writer = null;
          try {
              Charset resolvedCharset = Charset.forName(charset);
              boolean shouldWriteBom = writeBom && !self.toFile().exists();
              OutputStream out = Files.newOutputStream(self, CREATE, APPEND);
              if (shouldWriteBom) {
                  IOGroovyMethods.writeUTF16BomIfRequired(out, resolvedCharset);
              }
              writer = new OutputStreamWriter(out, resolvedCharset);
              InvokerHelper.write(writer, text);
              writer.flush();
  
              Writer temp = writer;
              writer = null;
              temp.close();
          } finally {
              closeWithWarning(writer);
          }
      }
docs: Append the text at the end of the Path, using a specified encoding.  If
  the given charset is "UTF-16BE" or "UTF-16LE" (or an equivalent alias),
  <code>writeBom</code> is <code>true</code>, and the file doesn't already
  exist, the requisite byte order mark is written to the file before the
  text is appended.
  
  @param self     a Path
  @param text     the text to append at the end of the Path
  @param charset  the charset used
  @param writeBom whether to write the BOM
  @throws java.io.IOException if an IOException occurs.
  @since 2.5.0