synchronized void receive(char oneChar) throws IOException {
  if (buffer == null) {
    throw new IOException("Pipe is closed");
  }
  if (lastReader != null && !lastReader.isAlive()) {
    throw new IOException("Pipe broken");
  }
  lastWriter=Thread.currentThread();
  try {
    while (buffer != null && out == in) {
      notifyAll();
      wait(1000);
      if (lastReader != null && !lastReader.isAlive()) {
        throw new IOException("Pipe broken");
      }
    }
  }
 catch (  InterruptedException e) {
    IoUtils.throwInterruptedIoException();
  }
  if (buffer == null) {
    throw new IOException("Pipe is closed");
  }
  if (in == -1) {
    in=0;
  }
  buffer[in++]=oneChar;
  if (in == buffer.length) {
    in=0;
  }
}

synchronized void receive ( char oneChar ) throws IOException { if ( buffer == null ) { throw new IOException ( "Pipe is closed" ) ; } if ( lastReader != null && ! lastReader . isAlive ( ) ) { throw new IOException ( "Pipe broken" ) ; } lastWriter = Thread . currentThread ( ) ; try { while ( buffer != null && out == in ) { notifyAll ( ) ; wait ( 1000 ) ; if ( lastReader != null && ! lastReader . isAlive ( ) ) { throw new IOException ( "Pipe broken" ) ; } } } catch ( InterruptedException e ) { IoUtils . throwInterruptedIoException ( ) ; } if ( buffer == null ) { throw new IOException ( "Pipe is closed" ) ; } if ( in == - 1 ) { in = 0 ; } buffer [ in ++ ] = oneChar ; if ( in == buffer . length ) { in = 0 ; } }
receives a char and stores it into the pipedreader . this called by pipedwriter . write ( ) when writes occur . < p > if the buffer is full and the thread sending # receive is interrupted , the interruptedioexception will be thrown .
