Ejemplo n.º 1
0
  /**
   * Save the document to a file.
   *
   * @see #write
   */
  public boolean save(String filename) {

    try {
      setFilename(filename);

      // write to tmp file
      File tmpfile = File.createTempFile("gwb", null);
      write(new FileOutputStream(tmpfile));

      // copy to dest file and delete tmp file
      FileUtils.copy(tmpfile, new File(filename));
      tmpfile.delete();

      //

      //
      fireDocumentInit();
      return true;
    } catch (Exception e) {
      LogUtils.report(e);
      return false;
    }
  }