#29 InputSource validity/lifetime

Petr Kuzel

I have problems while using InputSource in environments
where I got it as the only input context (i.e. a parser
implementation). Problem is that it becomes invalid (or
consumed) after first call to statefull stream returned
by e.g. getCharacterStream().

Unfortunatelly I need to do two phase processing so I
have to clone the input source somehow. It's nasty but
it's doeable

I'd appreciate createCharacterStream methods that would
create fresh stream and allowed InputSource sharing
(eliminating the example code). I think it's clean I
had to be in the original specs :-).


  • Anonymous - 2003-05-29
    • status: open --> closed-wont-fix
  • Anonymous - 2003-05-29

    Logged In: YES

    The basic "java.io" streams themselves can't
    be rewound, so you're going to have to have
    work around this somehow yourself.

    Consider an input stream that comes from a
    socket. Can't be rewound -- and that's a
    typical, and important case.

    For those few cases where you can realistically
    rewind the stream, as for file access, rather than
    create a new one (URLs etc), the solution has
    always needed to live in layers over SAX.

    The SharableInputSource.java code, I note, is
    just wrapping a huge buffer. That's a good
    example of the sort of thing that doesn't belong
    in low level infrastructure code.

  • Petr Kuzel

    Petr Kuzel - 2003-05-30

    Logged In: YES

    The SharableInputSource.java is a workaround.

    I was advocating if favor of removing it if InputSource
    defined createInputStream() method.


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks