cdm/src/main/java/ucar/nc2/FileWriter2.java
public NetcdfFile write(CancelTask cancel) throws IOException {

    try {
      if (version.isExtendedModel())
        addGroupExtended(null, fileIn.getRootGroup());
      else
        addGroupClassic();

      if (cancel != null && cancel.isCancel()) return null;

      // create the file
      writer.create();

      if (cancel != null && cancel.isCancel()) return null;
      double total = copyVarData(varList, null, cancel);
      if (cancel != null && cancel.isCancel()) return null;

      writer.flush();
      if (debug) System.out.println("FileWriter done total bytes = " + total);

    } catch (IOException ioe) {
      ioe.printStackTrace();
      writer.abort();  // clean up
      throw ioe;
    }

    return writer.getNetcdfFile();
  }
public NetcdfFile write(CancelTask cancel) throws IOException {

    try {
      if (version.isExtendedModel())
        addGroupExtended(null, fileIn.getRootGroup());
      else
        addGroupClassic();

      if (cancel != null && cancel.isCancel()) return null;

      // create the file
      writer.create();

      if (cancel != null && cancel.isCancel()) return null;
      double total = copyVarData(varList, null, cancel);
      if (cancel != null && cancel.isCancel()) return null;

      writer.flush();
      if (debug) System.out.println("FileWriter done total bytes = " + total);

    } catch (IOException ioe) {
      ioe.printStackTrace();
      writer.abort();  // clean up
      throw ioe;
    }

    return writer.getNetcdfFile();
  }
public NetcdfFile write ( CancelTask cancel ) throws IOException { try { if ( version . isExtendedModel ( ) ) addGroupExtended ( null , fileIn . getRootGroup ( ) ) ; else addGroupClassic ( ) ; if ( cancel != null && cancel . isCancel ( ) ) return null ; // create the file
 writer . create ( ) ; if ( cancel != null && cancel . isCancel ( ) ) return null ; double total = copyVarData ( varList , null , cancel ) ; if ( cancel != null && cancel . isCancel ( ) ) return null ; writer . flush ( ) ; if ( debug ) System . out . println ( "FileWriter done total bytes = " + total ) ; } catch ( IOException ioe ) { ioe . printStackTrace ( ) ; writer . abort ( ) ; // clean up
 throw ioe ; } return writer . getNetcdfFile ( ) ; }
Write the input file to the output file.
@param cancel  allow user to cancel; may be null.
@return the open output file.
@throws IOException
Write the input file to the output file .