commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jukka Zitting (JIRA)" <>
Subject [jira] Updated: (IO-71) [io] PipedUtils
Date Tue, 12 Feb 2008 22:51:08 GMT


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:

//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();

assertEquals("hello world", swresult.toString());

> [io] PipedUtils
> ---------------
>                 Key: IO-71
>                 URL:
>             Project: Commons IO
>          Issue Type: Improvement
>          Components: Utilities
>         Environment: Operating System: All
> Platform: All
>            Reporter: David Smiley
>            Priority: Minor
>             Fix For: 2.x
>         Attachments:, 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.

View raw message