title: Flaws with PipedInputStream/PipedOutputStream
body: <p>I've seen two answers on SO that claim that the <code>PipedInputStream</code> and <code>PipedOutputStream</code> classes provided by Java are flawed. But they did not elaborate on what was wrong with them. Are they really flawed, and if so in what way? I'm currently writing some code that uses them, so I'd like to know whether I'm taking a wrong turn.</p>
  
  <p><a href="https://stackoverflow.com/a/1867063/545127">One answer</a> said:</p>
  
  <blockquote>
    <p><code>PipedInputStream</code> and <code>PipedOutputStream</code> are broken (with regards to threading). They assume each instance is bound to a particular thread. This is bizarre.</p>
  </blockquote>
  
  <p>To me that seems neither bizarre nor broken. Perhaps the author also had some other flaws in mind?</p>
  
  <p><a href="https://stackoverflow.com/a/3402631/545127">Another answer</a> said:</p>
  
  <blockquote>
    <p>In practice they are best avoided. I've used them once in 13 years and I wish I hadn't.</p>
  </blockquote>
  
  <p>But that author could not recall what the problem was.</p>
  
  <hr>
  
  <p>As with all classes, and especially classes used in multiple threads, you will have problems if you misuse them. So I do not consider the unpredictable <a href="https://stackoverflow.com/questions/5453525/write-end-dead-exception-using-pipedinputstream-java">"write end dead" <code>IOException</code></a> that <code>PipedInputStream</code> can throw to be a flaw (failing to <code>close()</code> the connected <code>PipedOutputStream</code> is a bug; see the article <a href="http://techtavern.wordpress.com/2008/07/16/whats-this-ioexception-write-end-dead/" rel="nofollow noreferrer"><em>Whats this? IOException: Write end dead</em></a>, by Daniel Ferbers, for more information). What other claimed flaws are there?</p>