cdm/src/main/java/ucar/nc2/ncml/NcMLWriter.java
public void writeToStream(Element elem, OutputStream outStream) throws IOException {
    try (Writer writer = new BufferedWriter(new OutputStreamWriter(
            new BufferedOutputStream(outStream), xmlFormat.getEncoding()))) {
      writeToWriter(elem, writer);
    }
  }
public void writeToStream(Element elem, OutputStream outStream) throws IOException {
    try (Writer writer = new BufferedWriter(new OutputStreamWriter(
            new BufferedOutputStream(outStream), xmlFormat.getEncoding()))) {
      writeToWriter(elem, writer);
    }
  }
public void writeToStream ( Element elem , OutputStream outStream ) throws IOException { try ( Writer writer = new BufferedWriter ( new OutputStreamWriter ( new BufferedOutputStream ( outStream ) , xmlFormat . getEncoding ( ) ) ) ) { writeToWriter ( elem , writer ) ; } }
Writes an NcML element to an output stream.

@param elem  an NcML element.
@param outStream  the stream to write the NcML document to. Will be closed at end of the method.
@throws IOException  if there's any problem writing.
Writes an NcML element to an output stream .