Hello dear Stackoverflow community!
Let's get straight to my question: I have a socket and all input coming via this socket / stream is parsed by my SAX parser. Now, upon a certain parsing event I'd like to close the socket / stream from within my SAX event handler. Also, I want to close the stream from outside in a certain case while the parser is still working. Unfortunately, I can't do the one thing or the other without having an exception thrown by the parser (unexpected document ending...). Ok, I could catch this exception, but do you know a solution how to securely close the stream?