/* (non-Javadoc)
* @see org.apache.axiom.om.OMDataSource#serialize(java.io.OutputStream, org.apache.axiom.om.OMOutputFormat)
*/
public void serialize(OutputStream output, OMOutputFormat format) throws XMLStreamException {
MTOMXMLStreamWriter writer = new MTOMXMLStreamWriter(output, format);
serialize(writer);
writer.flush();
try {
writer.close();
} catch (XMLStreamException e) {
// An exception can occur if nothing is written to the
// writer. This is possible if the underlying data source
// writers to the output stream directly.
if (log.isDebugEnabled()) {