title: java nio and end of stream for stdin, stdout, stderr
body: <p>I have a program A that receives stdout of another program B in a ByteBuffer through a Pipe.SourceChannel.</p>
  
  <p>The program will read from the ByteBuffer for stdout until it reaches the end of stream (that is, until ByteBuffer's read() return -1).</p>
  
  <p>Can stdout of program B open and close multiple times in a program's execution?  That is, is it possible that read() return -1, but later program B has additional stdout, in which case program A should do another read() of the ByteBuffer?  </p>
  
  <p>Thanks in advance.</p>