use of org.apache.axiom.om.ds.ByteArrayDataSource in project webservices-axiom by apache.
the class ByteArrayCustomBuilder method create.
@Override
public OMDataSource create(OMElement element) throws OMException {
try {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
element.serializeAndConsume(baos);
byte[] bytes = baos.toByteArray();
return new ByteArrayDataSource(bytes, encoding);
} catch (XMLStreamException e) {
throw new OMException(e);
} catch (OMException e) {
throw e;
} catch (Throwable t) {
throw new OMException(t);
}
}
Aggregations