public int readLine(byte b[], int off, int len) throws IOException 
   {
      int total = 0;
      if (len == 0) return 0;
   
      int avail = count - pos;
      if (avail <= 0) 
      {
         fill();
         avail = count - pos;
         if (avail <= 0) return -1;
      }
      int copy = Math.min(len, avail);
      int eol = findeol(buf, pos, copy);
      if (eol != -1) copy = eol;
      System.arraycopy(buf, pos, b, off, copy);
      pos += copy;
      total += copy;
    
      while (total < len && eol == -1) 
      {
         fill();
         avail = count - pos;
         if(avail <= 0) return total;
         copy = Math.min(len - total, avail);
         eol = findeol(buf, pos, copy);
         if (eol != -1) copy = eol;
         System.arraycopy(buf, pos, b, off + total, copy);
         pos += copy;
         total += copy;
      }
      return total;
   }