cdm/src/main/java/ucar/nc2/util/IO.java
static public void writeContents(String contents, OutputStream os) throws IOException {
    ByteArrayInputStream bin = new ByteArrayInputStream(contents.getBytes(CDM.utf8Charset));
    IO.copy(bin, os);
  }
static public void writeContents(String contents, OutputStream os) throws IOException {
    ByteArrayInputStream bin = new ByteArrayInputStream(contents.getBytes(CDM.utf8Charset));
    IO.copy(bin, os);
  }
Wite the contents from the String to a Stream,

@param contents String holding the contents.
@param os       write to this OutputStream
@throws java.io.IOException on io error