protected synchronized void receive(int b) throws IOException { if (buffer == null) throw new IOException("pipe closed");
receive(int byte_received) throws IOException { int orig_in = in;
  protected synchronized void receive(int b) throws IOException  {    if (buffer == null)      throw new IOException("pipe closed");    // TBD: Spec says to throw IOException if thread reading from input stream    // died.  What does this really mean?  Theoretically, multiple threads    // could be reading to this object (why else would 'read' be synchronized?).    // Do you track the first, last, or all of them?    if (b < 0)      {        outClosed = true;	notifyAll();	// In case someone was blocked in a read.	return;      }    // Block until there's room in the pipe.    while (in == out)      try	{	  wait();	}      catch (InterruptedException ex)       {	 throw new InterruptedIOException();       }    // Check if buffer is empty.    if (in < 0)      in = 0;    buffer[in++] = (byte) b;    // Wrap back around if at end of the array.    if (in >= buffer.length)      in = 0;    // Let other threads know there's something to read when this returns.    notifyAll();  }