Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

FOP transformation, Piped Streams and Write end dead

843834Dec 16 2004 — edited Dec 16 2004
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
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 13 2005
Added on Dec 16 2004
1 comment
243 views