commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeremias Maerki <>
Subject Re: [IO] CCInputStream and its inverse
Date Fri, 12 Mar 2004 22:46:09 GMT
Sorry for not responding earlier. At the moment I don't see many use
cases for your two classes, I must say. So I'm a bit hesitant to take it
into IO. If anyone else thinks this is a "should-have" I will gladly

On 04.03.2004 12:53:29 Elifarley C. Coelho wrote:
> I´ve created a simple class to solve a problem I was facing. Maybe it´s 
> usefull enough to be included in commons-io. Here is a brief description:
> There´s a method in the servlet I´m working on which reads some data 
> sent from web browsers which must be in a certain format (multipart/form 
> -data). Sometimes the method would fail, so I thought it would be nice 
> if I could read all the data being read from the request´s InputStream.
> The CCInputStream does that. Below is an example:
> In place of
>    InputStream in = request.getInputStream();
> I wrote
>    InputStream in = CCInputStream.getInstance(
>      request.getInputStream(),
>      new FileOutputStream(File.createTempFile("req", "form-data"))
>    );
> So, at every new request, I had a new file with its contents, without 
> further modifications to the sservlet.
> There´s also another class wich is kind of an inverse of this concept 
> (it extends FilterOutputStream, instead of FilterInputStrea). This other 
> class can be used to "force" a pre-defined set of bytes to be fed to the 
> outputstream, so that you can test the expected behaviour of a method. 
> Maybe there are other uses as well. You would use it like this:
> OutputStream out = ForcedOutputStream.getInstance(
>    response.getOutputStream(),
>    new FileInputStream("testData.txt")
> );
> Please let me know if you find these classes elegible for inclusion in 
> commons-io (or not).
> Thank you.

Jeremias Maerki

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

View raw message