[JDEV] Question on using NIO with SAX
Chris Chen
ckchris at idream.net
Fri Mar 22 12:39:10 CST 2002
Well, I'm thinking of another way of wrapping a underlying stream into a
"faked blocking IO stream" for SAX.
What you can do is have NIO on one side, put all the data into a channel,
then create a data buffer processor that reads in the data from the
channel. This processor will also implement the InputStream interface so
that it can be read... Then you can just pass the wrapped stream to the
SAX handler. This way, SAX still thinks it's using a traditional stream
but the underlying implementation is actually using the new NIO.
I think this might work, but you do have to implement your own blocking
mechanism for the read() operation.
Chris
More information about the JDev
mailing list