public final boolean readLine(CharBuffer cb,boolean isChop) throws IOException {
  if (_readEncoding != null)   return readlnEncoded(cb,isChop);
  int capacity=cb.capacity();
  int offset=cb.length();
  char[] buf=cb.buffer();
  byte[] readBuffer=_readBuffer;
  while (true) {
    int readOffset=_readOffset;
    int readLength=_readLength;
    int sublen=Math.min(capacity - offset,readLength - readOffset);
    for (; sublen > 0; sublen--) {
      int ch=readBuffer[readOffset++] & 0xff;
      if (ch != '\n') {
        buf[offset++]=(char)ch;
      }
 else       if (isChop) {
        if (offset > 0 && buf[offset - 1] == '\r') {
          cb.length(offset - 1);
        }
 else {
          cb.length(offset);
        }
        _readOffset=readOffset;
        return true;
      }
 else {
        buf[offset++]=(char)'\n';
        cb.length(offset);
        _readOffset=readOffset;
        return true;
      }
    }
    _readOffset=readOffset;
    if (readLength <= readOffset) {
      if (!readBuffer()) {
        cb.length(offset);
        return offset > 0;
      }
    }
    if (capacity <= offset) {
      cb.length(offset + 1);
      capacity=cb.capacity();
      buf=cb.buffer();
    }
  }
}

public final boolean readLine ( CharBuffer cb , boolean isChop ) throws IOException { if ( _readEncoding != null ) return readlnEncoded ( cb , isChop ) ; int capacity = cb . capacity ( ) ; int offset = cb . length ( ) ; char [ ] buf = cb . buffer ( ) ; byte [ ] readBuffer = _readBuffer ; while ( true ) { int readOffset = _readOffset ; int readLength = _readLength ; int sublen = Math . min ( capacity - offset , readLength - readOffset ) ; for ( ; sublen > 0 ; sublen -- ) { int ch = readBuffer [ readOffset ++ ] & 0xff ; if ( ch != '\n' ) { buf [ offset ++ ] = ( char ) ch ; } else if ( isChop ) { if ( offset > 0 && buf [ offset - 1 ] == '\r' ) { cb . length ( offset - 1 ) ; } else { cb . length ( offset ) ; } _readOffset = readOffset ; return true ; } else { buf [ offset ++ ] = ( char ) '\n' ; cb . length ( offset ) ; _readOffset = readOffset ; return true ; } } _readOffset = readOffset ; if ( readLength <= readOffset ) { if ( ! readBuffer ( ) ) { cb . length ( offset ) ; return offset > 0 ; } } if ( capacity <= offset ) { cb . length ( offset + 1 ) ; capacity = cb . capacity ( ) ; buf = cb . buffer ( ) ; } } }
reads a line into the character buffer . \ r \ n is converted to \ n .
