@Override
public void doFinal() throws XMLStreamException {
if (getTransformer() != null) {
UnsynchronizedByteArrayOutputStream baos = (UnsynchronizedByteArrayOutputStream)getOutputStream();
getTransformer().transform(new UnsynchronizedByteArrayInputStream(baos.toByteArray()));
getTransformer().doFinal();
}
}