code: public void saveAs(final File file) throws IOException {
          try {
              final FileOutputStream out = new FileOutputStream(file);
              try {
                  this.save(out);
              } finally {
                  out.flush();
                  out.close();
              }
          } catch (final FileNotFoundException e) {
              this.logger.log(Level.SEVERE, "Can't open " + file, e);
              throw new IOException(e);
          } catch (final NullPointerException e) {
              this.logger.log(Level.SEVERE, "No file", e);
              throw new IOException(e);
          }
      }
docs: Save the new file.
  
  @param file the destination file
  @throws IOException If an I/O error occurs