public void open() throws IOException {
    if (isClosed()) {
      if (file == null) {
        throw new IOException("Missing file path");
      } else {
        csvPrinter = new CSVPrinter(new FileWriter(file, true), CSVFormat.DEFAULT);

        // If the file is empty, write the header; else don't write the header.
        if (file.length() == 0) {
          // Write the header....
          Iterable<?> headerRecord = getHeaderRecord();
          csvPrinter.printRecord(headerRecord);
        }
      }
    }
  }
Opens the data file for writing.
<p/>
This may be called multiple times and the appropriate action will occur depending on if the
file has been previously opened or closed.

@throws java.io.IOException
ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/AbstractKerberosDataFileWriter.java