Currently, the RereadableInputStream is intended as a wrapper around a stream, kind of like a BufferedInputStream. It was intended to be used by, for example, an MS Word parser implementation that needed to make multiple passes over the data.
Like the BufferedInputStream, the RereadableInputStream closes the stream it's wrapping when its close() is called. This seemed like the logical thing to do at the time. Unfortunately, this is contrary to our statement in the Parser javadoc that says:
"The given stream is consumed but not closed by this method. The responsibility to close the stream remains on the caller."
Shall I change RereadableInputStream so that it does not close the stream it wraps? This would make it conform with our current usage. However, it might be a little surprising to a user of the class (and this class may be useful outside of our current use case). Perhaps there could be a 'closeOriginalStream' constructor parameter? This would support our use case while still providing the opportunity to use the class in a more general way. This would be my preference. What do you think?