xml - StAX parsing from Java NIO channel -
I am trying to get a stream of XML events on a Java NIO channel. I am new to both NIO and steak parsing, so I can see something with little ease :)
My search has inspired me to implement several Sachs and stocks, but all these inputstream And work on input sources - -Non channel Two close attempts made by me have been made to get the inststream from the channel and to create a piped intestream:
// method 1 P IpedOutputStream out = new PipedOutputStream (); InputStream = new (outside) in PipedInputStream; Printer author = new printer (out); // Method 2 InputStream = channel.socket (). GetInputStream () // Method 3 IputStream = In the Channel New inputstream (channel);
After that:
XMLStreamReader xmlStreamReader = XMLInputFactory.newInstance () .createXMLStreamReader (in); // ...
When the code above is used with 1 method, the XMLMLStreamReader blocks it to create when the method 2/3 is used, So they immediately throw illegal blocking exceptions (I understand why). Maybe a new approach is needed?
My goal is to be a non-blocker server = = Accept character data from client => parse XML events by using specific encoding => Forward that event object processing => For another thread and return to the selection.
Am I seeing something, or better way that can be used? If so what?
Thank you!
Are you sure that you are NIO? It can not offer the basically expected relative benefits:
Paul Tyma:
Paul Tyma:
Showing a stack where the inside is made XMLStreamReader () is blocking it can help, but it's probably supposed to behave as a design. If it was designed to work against the instream, which always gives either (1) the expected amount of data; (2) end; Or (3) block, it will not automatically behave in a (usually more complex and stately) manner, which can return without reading any incomplete input, without deep re
Comments
Post a Comment