/** * Writes an NcML element to an output file. * * @param elem an NcML element. * @param outFile the file to write the NcML document to. * @throws IOException if there's any problem writing. */ public void writeToFile(Element elem, File outFile) throws IOException { try (OutputStream outStream = new BufferedOutputStream(new FileOutputStream(outFile, false))) { writeToStream(elem, outStream); } }
/** * Write the NcML representation. * * @param os write to this Output Stream. * @param uri use this for the url attribute; if null use getLocation(). * @throws IOException */ @Override public void writeNcML(java.io.OutputStream os, String uri) throws IOException { NcMLWriter ncmlWriter = new NcMLWriter(); Element netcdfElem = ncmlWriter.makeNetcdfElement(this, uri); ncmlWriter.writeToStream(netcdfElem, os); }
/** * Write the NcML representation: dont show coodinate values * * @param os : write to this OutputStream. Will be closed at end of the method. * @param uri use this for the url attribute; if null use getLocation(). // ?? * @throws IOException if error * @see NcMLWriter#writeToStream */ public void writeNcML(java.io.OutputStream os, String uri) throws IOException { NcMLWriter ncmlWriter = new NcMLWriter(); Element netcdfElem = ncmlWriter.makeNetcdfElement(this, uri); ncmlWriter.writeToStream(netcdfElem, os); }
NcMLWriter ncmlWriter = new NcMLWriter(); Element netcdfElem = ncmlWriter.makeNetcdfElement(ncfile, null); ncmlWriter.writeToStream(netcdfElem, out);