protected void transformContent(Transformer transformer, MessageExchange exchange, NormalizedMessage in, NormalizedMessage out) throws TransformerException, MessagingException {
if (isUseStringBuffer()) {
StringWriter buffer = new StringWriter();
Result result = new StreamResult(buffer);
transformer.transform(in.getContent(), result);
out.setContent(new StringSource(buffer.toString()));
}
else {
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
Result result = new StreamResult(buffer);
transformer.transform(in.getContent(), result);