dev@fi.java.net

Re: StAX factories and TCK

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Tue, 11 Jan 2005 12:20:14 +0100

Joe Wang wrote:
> InputFactory:
> As discussed with Santiago (see below), when the input is a XML file in
> the form of a java.io.Reader, InputFactory will convert it into FI
> format before it can return a stream reader. I've added a "convert"
> method in tool XML_SAX_FI to transform the xml file into an
> OutputStream. In the InputFactory, the createXMLStreamReader method will
> use a PipedOutputStream to call this method
> (XML_SAX_FI->convert(xml,outputStream)). This is to avoid writing the
> resulting FI doc out to the file system. The OutputStream will then be
> used to create a PipedInputStream which will be used to create a stream
> reader StAXDocumentParser(inputStream, manager) (*for this new
> constructor, pls see the next email).
> Frankly, I'm not familiar with Piped streams, only know it
> conceptually. Will need to test it out. Initially, I thought about
> writing out temporary FI files, but believed the piped streams would be
> better.
>

PipedOutputStream would be used more in the case of asynchronous processing.

In your case it should all be synchronous so it should also be possible
to write/read directly to/from memory using ByteArrayInout/OutputStream.

Note the warning in the JavaDoc for PipedOutputStream:

"Attempting to use both objects from a single thread is not recommended
as it may deadlock the thread."

So it might be OK but...

Paul.

-- 
| ? + ? = To question
----------------\
    Paul Sandoz
         x38109
+33-4-76188109
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe_at_fi.dev.java.net
For additional commands, e-mail: dev-help_at_fi.dev.java.net