*/
@SuppressWarnings("unchecked")
protected <T extends Result>T createStAXResult(
Class<T> resultClass) throws SQLException {
StAXResult result = null;
OutputStream outputStream = this.setBinaryStreamImpl();
Constructor ctor;
XMLOutputFactory factory;
XMLStreamWriter xmlStreamWriter;
try {
factory = XMLOutputFactory.newInstance();
xmlStreamWriter = factory.createXMLStreamWriter(outputStream);
if (resultClass == null) {
result = new StAXResult(xmlStreamWriter);
} else {
ctor = resultClass.getConstructor(XMLStreamWriter.class);
result = (StAXResult) ctor.newInstance(xmlStreamWriter);
}
} catch (SecurityException ex) {