public final void writeList(Class<?> elementType, Collection<?> t,
MediaType mediaType, Charset c,
Marshaller m, OutputStream entityStream)
throws JAXBException, IOException {
final XMLStreamWriter xsw = new StAXDocumentSerializer(entityStream);
final String rootElement = getRootElementName(elementType);
try {
xsw.writeStartDocument();
xsw.writeStartElement(rootElement);
for (Object o : t)
m.marshal(o, xsw);
xsw.writeEndElement();
xsw.writeEndDocument();
xsw.flush();
} catch (XMLStreamException cause) {
throw ThrowHelper.withInitCause(cause,
new IOException()
);
}