Hi guys,
I'm having a little trouble with my pipes...
Not an infection of a personal nature, no, I mean my PipedInputStream and PipedOutputStream.
I'm trying to take the result of an XSLT transformation which produces FO content and pipe that directly through to a transformerFactory.newTransformer().transform() method.
The PipedOutputStream is wrapped in a StreamSource and accepts the transformed FO content and the PipedInputStream is also wrapped in a StreamSource and feeds it through to the "newTransformer".
The trouble is I'm getting:
javax.xml.transform.TransformerException : Write end dead
which I'm finding really hard to diagnose.
Firstly, is there a more direct way of sending the results of the initial transformation to the FOP renderer end of the process?
Secondly, can anyone suggest reasons why the pipes might be throwing errors?
/*
* define the linked pipes
*/
final PipedOutputStream pipeOut = new PipedOutputStream();
final PipedInputStream pipeIn = new PipedInputStream(pipeOut);
/*
* wrap up the buffered input and the xsl file in StreamSource instances and call the transform method
* we want our output to be written straight to the browser so we pass through out OutputStream
*/
Thread xslThread = new Thread() {
public void run() {
try {
transform(xmlSource, xslSource, pipeOut);
pipeOut.flush();
}catch(Exception e) {
logException(method+":: transformation", e);
this.destroy();
}
}
};
xslThread.start();
foConversion(pipeIn, out, Driver.RENDER_PDF);
xslThread.join();
Mark