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");
    }
    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;
  }
}

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" ) ; } 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 ; } }
receives a char of data . this method will block if no input is available .
