ByteArrayOutputStream boas = new ByteArrayOutputStream();
OutputStreamWriter osw = new OutputStreamWriter(boas, "UTF-8");
toString(contentType, flags, osw);
return boas.toString();
} catch (UnsupportedEncodingException e) {
throw new RepresentationException("Unable to write representation: " + e.getMessage());
}
}