I'm looking for an XML parser that instead of parsing from an InputStream or InputSource will instead allow blocks of text to be pushed into the parser. E.g. I would like to have something like the following:
public class DataReceiver {
private SAXParser parser = //...
private DefaultHandler handler = //...
/**
* Called each time some data is received.
*/
public void onDataReceived(byte[] data) {
parser.push(data, handler);
}
}
The reason is that I would like something that will play nice with the NIO networking libraries rather than having to revert back to a thread per connection model required to support a blocking InputStream.
call-cc
. Then we could get this just by implementingInputStream
. – Towel