commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Keith R. Bennett" <>
Subject RereadableInputStream
Date Thu, 11 Oct 2007 20:35:09 GMT

Hello, all.  I am working with the Apache Tika project.  We found the need to
get a newly opened input stream from the user, and possibly read it multiple
times.  I am aware of the mark and release methods, but we needed to support
streams of arbitrary length, so I thought we'd have to figure something else

I created a class, and I'd like your feedback on it.  If you'd like to
include it, or something based on it, in a future version of your project,
feel free.  Or, if it's a bad idea, or you can suggest modifications or a
totally different approach that would fulfill the need more wisely, please
let me know.

It's called RereadableInputStream.  It saves the bytes read from the
original stream in a byte [], until a user-specified threshold is reached,
then it moves the buffer to a temporary file.

I'm attaching the file and a basic unit test class to this message.  This
version is newer than the one currently in Tika's subversion repository. 
For reasons that I won't bore you with, this version is not yet committed.

Thanks for any help you can offer.

Keith Bennett 
View this message in context:
Sent from the Commons - Dev mailing list archive at

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message