public final synchronized String readLine(int timeoutMillis){
  if (closed)   return null;
  try {
    if (lines.isEmpty()) {
      if (timeoutMillis > 0)       wait(timeoutMillis);
 else       wait();
    }
    if (lines.isEmpty())     return closed ? null : "";
    String ret=lines.get(0);
    lines.remove(0);
    return ret;
  }
 catch (  InterruptedException e) {
    return null;
  }
}

public final synchronized String readLine ( int timeoutMillis ) { if ( closed ) return null ; try { if ( lines . isEmpty ( ) ) { if ( timeoutMillis > 0 ) wait ( timeoutMillis ) ; else wait ( ) ; } if ( lines . isEmpty ( ) ) return closed ? null : "" ; String ret = lines . get ( 0 ) ; lines . remove ( 0 ) ; return ret ; } catch ( InterruptedException e ) { return null ; } }
read a line from the pipe . returns null on failure . returns empty string on timeout .
