code: public final int readLine(char []buf, int length, boolean isChop)
      throws IOException
    {
      byte []readBuffer = _readBuffer;
  
      int offset = 0;
  
      while (true) {
        int readOffset = _readOffset;
  
        int sublen = Math.min(length, _readLength - readOffset);
  
        for (; sublen > 0; sublen--) {
          int ch = readBuffer[readOffset++] & 0xff;
  
          if (ch != '\n') {
          }
          else if (isChop) {
            _readOffset = readOffset;
  
            if (offset > 0 && buf[offset - 1] == '\r')
              return offset - 1;
            else
              return offset;
          }
          else {
            buf[offset++] = (char) ch;
  
            _readOffset = readOffset;
  
            return offset + 1;
          }
  
          buf[offset++] = (char) ch;
        }
        _readOffset = readOffset;
  
        if (readOffset <= _readLength) {
          if (! readBuffer()) {
            return offset;
          }
        }
  
        if (length <= offset)
          return length + 1;
      }
    }
docs: Reads a line into the character buffer.  \r\n is converted to \n.
  
  @param buf character buffer to fill.
  @param length number of characters to fill.
  
  @return -1 on end of file or the number of characters read.