code: synchronized void receive(int c) throws IOException {
          if (!connected) {
              throw new IOException("Pipe not connected");
          } else if (closedByWriter || closedByReader) {
              throw new IOException("Pipe closed");
          } else if (readSide != null && !readSide.isAlive()) {
              throw new IOException("Read end dead");
          }
  
          writeSide = Thread.currentThread();
          while (in == out) {
              if ((readSide != null) && !readSide.isAlive()) {
                  throw new IOException("Pipe broken");
              }
              /* full: kick any waiting readers */
              notifyAll();
              try {
                  wait(1000);
              } catch (InterruptedException ex) {
                  throw new java.io.InterruptedIOException();
              }
          }
          if (in < 0) {
              in = 0;
              out = 0;
          }
          buffer[in++] = (char) c;
          if (in >= buffer.length) {
              in = 0;
          }
      }
docs: Receives a char of data. This method will block if no input is
  available.