private byte[] _getBytesFromBO(Object busObj, Object busContext, String encoding)
throws XMLStreamException, WebServiceException {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
// Exposes getOutputStream, which allows faster writes.
XMLStreamWriterWithOS writer = new XMLStreamWriterWithOS(baos, encoding);
// Write the business object to the writer
_outputFromBO(busObj, busContext, writer);
// Flush the writer
writer.flush();
writer.close();
return baos.toByteArray();
}