Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

7
  • The writes should be synchronized. Commented Nov 2, 2011 at 21:53
  • 1
    You can simplify that. Have it extend FilterOutputStream; construct it with super(out); get rid of the out member; and change all the out. references to super. references.
    – user207421
    Commented Nov 3, 2011 at 0:19
  • @Dave Depends on the use case. EJP I like it better this way, but that would work also. Commented Nov 3, 2011 at 7:49
  • @DaveNewton Mind explaining your comment about "writes should be synchronized", is it mandatory? Do regularl java io streams use a synchronized keyword?
    – Whome
    Commented Mar 16, 2017 at 14:16
  • 1
    @KohányiRóbert There is something magical. Using code that lots of other people are using increases the likelihood that any bugs in the code are found and fixed. For example, when out.close() throws an IOException and tee.close() is skipped because exception handling did not ensure the second stream got closed.
    – neuralmer
    Commented Apr 24, 2018 at 18:30