You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by h....@gambit-gmbh.de on 2002/11/28 16:47:27 UTC

Xerces closes InputStream

This ยง$%&/ Xerces closes the input stream i gave him for input.
Why does it close a stream it hasn't opened? I stop parsing
with an exception thrown in endElement.

This is really annoying if you parse the input of a socket which
is closed both ways if the stream is closed. You will never be
able to write back an answer.

Solution is a wrapper for the input stream which overwrites
the close method.

Haug

public class ProtectedInputStream extends InputStream {
    private InputStream is;
    public ProtectedInputStream(InputStream is) {
        this.is = is;
    }
    public int read() throws IOException {
        return is.read();
    }
    public void close() {
    }
}