Details

    • Type: New Feature New Feature
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.4
    • Component/s: Streams/Writers
    • Labels:
      None

      Description

      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.

      1. commons-io-TeeInputStream-close.patch
        3 kB
        Jukka Zitting
      2. commons-io-TeeInputStream-autoclose.patch
        2 kB
        Niall Pemberton
      3. IO-129.patch
        8 kB
        Jukka Zitting

        Activity

        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open Resolved Resolved
        2d 1h 8m 1 Niall Pemberton 15/Oct/07 11:41
        Resolved Resolved Closed Closed
        311d 19h 54m 1 Henri Yandell 22/Aug/08 07:36
        Mark Thomas made changes -
        Workflow jira [ 12415010 ] Default workflow, editable Closed status [ 12601737 ]
        Henri Yandell made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Niall Pemberton made changes -
        Resolution Fixed [ 1 ]
        Status Open [ 1 ] Resolved [ 5 ]
        Hide
        Niall Pemberton added a comment -

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

        Show
        Niall Pemberton added a comment - OK your patch and AutoCloseInputStream suggestion covers all bases - so I agree thats better. I've commited your patch - thanks
        Jukka Zitting made changes -
        Attachment commons-io-TeeInputStream-close.patch [ 12367739 ]
        Hide
        Jukka Zitting added a comment -

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

        Show
        Jukka Zitting added a comment - 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));
        Niall Pemberton made changes -
        Hide
        Niall Pemberton added a comment -

        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.

        Show
        Niall Pemberton added a comment - 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.
        Jukka Zitting made changes -
        Field Original Value New Value
        Attachment IO-129.patch [ 12367682 ]
        Hide
        Jukka Zitting added a comment -

        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.

        Show
        Jukka Zitting added a comment - 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.
        Jukka Zitting created issue -

          People

          • Assignee:
            Unassigned
            Reporter:
            Jukka Zitting
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development