Code example for InputStream

Methods: availableread

0
  private int readMore() throws InterruptedException, IOException { 
    int tmp = 0;
    int avail;
    try { 
      lock.acquire();
      avail = in.available();
      if (avail == 0) {
        lock.release();
        Thread.sleep(20);
        return a;
      } 
      if (a + avail > buf.length) {
        avail = buf.length - a;
      } 
      if (avail > 0) {
        tmp = in.read(buf, a, avail);
      } 
      if (tmp > 0) {
        a += tmp;
        parent.lastRead = System.currentTimeMillis();
      } 
Experience pair programming with AI  Get Codota for Java