// Use an OutputStream directly instead of a Writer for performance.
XMLStreamWriter xsw = null;
if (isBadgerFishConventionUsed) {
xsw = new BadgerFishXMLStreamWriter(new OutputStreamWriter(entityStream));
} else {
MappedNamespaceConvention con = new MappedNamespaceConvention(outputConfiguration);
xsw = new MappedXMLStreamWriter(con, new OutputStreamWriter(entityStream));
}
marshaller.marshal(entityToMarshal, xsw);
} catch (JAXBException e) {
logger.error(Messages.getMessage("jaxbFailToMarshal"), type.getName()); //$NON-NLS-1$