You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Jukka Zitting (JIRA)" <ji...@apache.org> on 2007/10/13 12:33:50 UTC

[jira] Created: (IO-129) Add TeeInputStream

Add TeeInputStream
------------------

                 Key: IO-129
                 URL: https://issues.apache.org/jira/browse/IO-129
             Project: Commons IO
          Issue Type: New Feature
          Components: Streams/Writers
            Reporter: Jukka Zitting
            Priority: Minor
             Fix For: 1.4


There should be a TeeInputStream class that transparently writes all bytes read from an input stream to a given output stream. Such a class could be used to easily record and log various inputs like incoming network streams, etc. The class would also be nicely symmetric with the existing TeeOutputStream class.

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


[jira] Updated: (IO-129) Add TeeInputStream

Posted by "Niall Pemberton (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/IO-129?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Niall Pemberton updated IO-129:
-------------------------------

    Attachment: commons-io-TeeInputStream-autoclose.patch

Thanks Jukka, I have committed this.

The only comment I have is on the decision to not provide anything for closing the OutputStream. Seems like it would be a useful feature to be able to configure this impl. to automatically close the output stream at the end of the input - attaching a suggested patch for comments.

> Add TeeInputStream
> ------------------
>
>                 Key: IO-129
>                 URL: https://issues.apache.org/jira/browse/IO-129
>             Project: Commons IO
>          Issue Type: New Feature
>          Components: Streams/Writers
>            Reporter: Jukka Zitting
>            Priority: Minor
>             Fix For: 1.4
>
>         Attachments: commons-io-TeeInputStream-autoclose.patch, IO-129.patch
>
>
> There should be a TeeInputStream class that transparently writes all bytes read from an input stream to a given output stream. Such a class could be used to easily record and log various inputs like incoming network streams, etc. The class would also be nicely symmetric with the existing TeeOutputStream class.

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


[jira] Updated: (IO-129) Add TeeInputStream

Posted by "Jukka Zitting (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/IO-129?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jukka Zitting updated IO-129:
-----------------------------

    Attachment: commons-io-TeeInputStream-close.patch

Not closing the output stream is designed for constructs like new TeeInputStream(..., System.out). I agree that making the close behaviour configurable is a good feature.

Instead of the auto-close feature, I'd rather make the option to close the associated output stream work in the close() method of the proxy stream. See the attached patch commons-io-TeeInputStream-close.patch for a proposed implementation.

One could use the AutoCloseInputStream decorator to get auto-close functionality:

    new AutoCloseInputStream(new TeeInputStream(..., ..., true));

> Add TeeInputStream
> ------------------
>
>                 Key: IO-129
>                 URL: https://issues.apache.org/jira/browse/IO-129
>             Project: Commons IO
>          Issue Type: New Feature
>          Components: Streams/Writers
>            Reporter: Jukka Zitting
>            Priority: Minor
>             Fix For: 1.4
>
>         Attachments: commons-io-TeeInputStream-autoclose.patch, commons-io-TeeInputStream-close.patch, IO-129.patch
>
>
> There should be a TeeInputStream class that transparently writes all bytes read from an input stream to a given output stream. Such a class could be used to easily record and log various inputs like incoming network streams, etc. The class would also be nicely symmetric with the existing TeeOutputStream class.

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


[jira] Updated: (IO-129) Add TeeInputStream

Posted by "Jukka Zitting (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/IO-129?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jukka Zitting updated IO-129:
-----------------------------

    Attachment: IO-129.patch

Attached a patch with the TeeInputStream class and an associated test case.

The TeeInputStream class is marked with "@since 1.4", hoping that the patch would make it for the 1.4 release.

> Add TeeInputStream
> ------------------
>
>                 Key: IO-129
>                 URL: https://issues.apache.org/jira/browse/IO-129
>             Project: Commons IO
>          Issue Type: New Feature
>          Components: Streams/Writers
>            Reporter: Jukka Zitting
>            Priority: Minor
>             Fix For: 1.4
>
>         Attachments: IO-129.patch
>
>
> There should be a TeeInputStream class that transparently writes all bytes read from an input stream to a given output stream. Such a class could be used to easily record and log various inputs like incoming network streams, etc. The class would also be nicely symmetric with the existing TeeOutputStream class.

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


[jira] Resolved: (IO-129) Add TeeInputStream

Posted by "Niall Pemberton (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/IO-129?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Niall Pemberton resolved IO-129.
--------------------------------

    Resolution: Fixed

OK your patch and AutoCloseInputStream suggestion covers all bases - so I agree thats better. I've commited your patch - thanks :)

> Add TeeInputStream
> ------------------
>
>                 Key: IO-129
>                 URL: https://issues.apache.org/jira/browse/IO-129
>             Project: Commons IO
>          Issue Type: New Feature
>          Components: Streams/Writers
>            Reporter: Jukka Zitting
>            Priority: Minor
>             Fix For: 1.4
>
>         Attachments: commons-io-TeeInputStream-autoclose.patch, commons-io-TeeInputStream-close.patch, IO-129.patch
>
>
> There should be a TeeInputStream class that transparently writes all bytes read from an input stream to a given output stream. Such a class could be used to easily record and log various inputs like incoming network streams, etc. The class would also be nicely symmetric with the existing TeeOutputStream class.

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