int read()

in src/com/pty4j/unix/Pty.java [239:251]


  int read(byte[] buf, int len) throws IOException {
    int fd = myMaster;
    if (fd == -1) return -1;

    boolean haveBytes;
    synchronized (mySelectLock) {
      if (myPipe[0] == -1) return -1;

      haveBytes = useSelect ? select(myPipe[0], fd) : poll(myPipe[0], fd);
    }

    return haveBytes ? CLibrary.read(fd, buf, len) : -1;
  }