docs: public static <T> void writeTo(OutputStream out, T message, Schema<T> schema,
              XMLOutputFactory outFactory) throws IOException
      {
          XMLStreamWriter writer = null;
          try
          {
              writer = outFactory.createXMLStreamWriter(out, XML_ENCODING);
  
              writer.writeStartDocument(XML_ENCODING, XML_VERSION);
              writeTo(writer, message, schema);
              writer.writeEndDocument();
  
              writer.flush();
          }
          catch (XMLStreamException e)
          {
              throw new XmlOutputException(e);
          }
          finally
          {
              if (writer != null)
              {
                  try
                  {
                      writer.close();
                  }
                  catch (XMLStreamException e)
                  {
                      // ignore
                  }
              }
          }
      }