code: 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;
    }
docs: Implement buffering on top of the <code>readLine</code> method of
  the wrapped <code>ServletInputStream</code>.
  
  @param b    an array of bytes into which data is read.
  @param off  an integer specifying the character at which
  this method begins reading.
  @param len  an integer specifying the maximum number of
  bytes to read.
  @return     an integer specifying the actual number of bytes
  read, or -1 if the end of the stream is reached.
  @exception  IOException  if an I/O error occurs.