[ 
https://issues.apache.org/jira/browse/IO-71?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Jukka Zitting updated IO-71:
----------------------------

    Attachment: ReverseFilterOutputStream.patch

See the attached patch (ReverseFilterInputStream.patch) for a simple draft (not 
thoroughly tested or documented) of a class that turns an OutputStream filter 
into an InputStream filter without the need for an extra thread or a pipe.

With the ReverseFilterInputStream class your example test case would become:

{code}
//starting data
InputStream original = new ByteArrayInputStream("hello 
world".getBytes("us-ascii"));

// Compress
InputStream reversed = new ReverseFilterInputStream(original, 
GZIPOutputStream.class);

// Uncompress
InputStream results = new GZIPInputStream(reversed);

//show results
StringWriter swresult = new StringWriter();
CopyUtils.copy(results,swresult);

assertEquals("hello world", swresult.toString());
{code}


> [io] PipedUtils
> ---------------
>
>                 Key: IO-71
>                 URL: https://issues.apache.org/jira/browse/IO-71
>             Project: Commons IO
>          Issue Type: Improvement
>          Components: Utilities
>         Environment: Operating System: All
> Platform: All
>            Reporter: David Smiley
>            Priority: Minor
>             Fix For: 2.x
>
>         Attachments: PipedUtils.zip, ReverseFilterOutputStream.patch
>
>
> I developed some nifty code that takes an OutputStream and sort  of  reverses 
> it as if it were an 
> InputStream.  Error passing and  handling  close is dealt with.  It needs 
> another thread to do the  work 
> which  runs in parallel.  It uses Piped streams.  I created  this because I  
> had to conform 
> GZIPOutputStream to my framework  which demanded an  InputStream.
> See URL to source.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to