You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tika.apache.org by "Keith R. Bennett" <kb...@bbsinc.biz> on 2007/10/09 21:44:23 UTC

RereadableInputStream Closes the Original Stream

All -

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?

Thanks,
Keith


-- 
View this message in context: http://www.nabble.com/RereadableInputStream-Closes-the-Original-Stream-tf4596455.html#a13123142
Sent from the Apache Tika - Development mailing list archive at Nabble.com.


Re: RereadableInputStream Closes the Original Stream

Posted by "Keith R. Bennett" <kb...@bbsinc.biz>.
Bertrand -

Thanks for your advice.  I've changed the code accordingly, and the patch is
attached to TIKA-52.  Since it may be a while before I can commit, is there
someone else who could do that?

Thanks and regards,
Keith



Bertrand Delacretaz wrote:
> 
> On 10/9/07, Keith R. Bennett <kb...@bbsinc.biz> wrote:
> 
>> ...Shall I change RereadableInputStream so that it does not close the
>> stream it
>> wraps?...
>> ...Perhaps there could be a
>> 'closeOriginalStream' constructor parameter?...
> 
> That's probably the easiest thing to do.
> 
> -Bertrand
> 
> 

-- 
View this message in context: http://www.nabble.com/RereadableInputStream-Closes-the-Original-Stream-tf4596455.html#a13157332
Sent from the Apache Tika - Development mailing list archive at Nabble.com.


Re: RereadableInputStream Closes the Original Stream

Posted by Bertrand Delacretaz <bd...@apache.org>.
On 10/9/07, Keith R. Bennett <kb...@bbsinc.biz> wrote:

> ...Shall I change RereadableInputStream so that it does not close the stream it
> wraps?...
> ...Perhaps there could be a
> 'closeOriginalStream' constructor parameter?...

That's probably the easiest thing to do.

-Bertrand