public Data transform(Data data, XMLCryptoContext xMLCryptoContext, OutputStream outputStream) throws TransformException {
_canonicalizer.setStream(outputStream);
_canonicalizer.reset();
if(data instanceof StreamWriterData){
StreamWriterData swd = (StreamWriterData)data;
NamespaceContextEx nc = swd.getNamespaceContext();
Iterator<NamespaceContextEx.Binding> itr = nc.iterator();
while(itr.hasNext()){
final NamespaceContextEx.Binding nd = itr.next();
try {
_canonicalizer.writeNamespace(nd.getPrefix(),nd.getNamespaceURI());
} catch (XMLStreamException ex) {
logger.log(Level.SEVERE, LogStringsMessages.WSS_1759_TRANSFORM_ERROR(ex.getMessage()),ex);
throw new TransformException(ex);
}
}
try {
ExcC14NParameterSpec spec = (ExcC14NParameterSpec)_transformParameterSpec;
if(spec != null){
_canonicalizer.setInclusivePrefixList(spec.getPrefixList());
}
swd.write(_canonicalizer);
_canonicalizer.flush();
} catch (XMLStreamException ex) {
logger.log(Level.SEVERE, LogStringsMessages.WSS_1759_TRANSFORM_ERROR(ex.getMessage()),ex);
throw new TransformException(ex);
}