protected int copyToBuffer(StringBuilder s, int initialLen, int startChar, int currentChar) {
    int overrun = 0;
    int currentSize = s.length() - initialLen;
    int readSize = currentChar - startChar;
    if (maxLine > -1 && currentSize + readSize > maxLine) {
      int adjustedReadSize = maxLine - currentSize;
      if (adjustedReadSize > 0) {
        s.append(cb, startChar, adjustedReadSize);
        overrun = readSize - adjustedReadSize;
      } else {
        overrun = readSize;
      }
    } else {
      s.append(cb, startChar, readSize);
    }
    return overrun;
  }
protected int copyToBuffer(StringBuilder s, int initialLen, int startChar, int currentChar) {
    int overrun = 0;
    int currentSize = s.length() - initialLen;
    int readSize = currentChar - startChar;
    if (maxLine > -1 && currentSize + readSize > maxLine) {
      int adjustedReadSize = maxLine - currentSize;
      if (adjustedReadSize > 0) {
        s.append(cb, startChar, adjustedReadSize);
        overrun = readSize - adjustedReadSize;
      } else {
        overrun = readSize;
      }
    } else {
      s.append(cb, startChar, readSize);
    }
    return overrun;
  }
protected int copyToBuffer ( StringBuilder s , int initialLen , int startChar , int currentChar ) { int overrun = 0 ; int currentSize = s . length ( ) - initialLen ; int readSize = currentChar - startChar ; if ( maxLine > - 1 && currentSize + readSize > maxLine ) { int adjustedReadSize = maxLine - currentSize ; if ( adjustedReadSize > 0 ) { s . append ( cb , startChar , adjustedReadSize ) ; overrun = readSize - adjustedReadSize ; } else { overrun = readSize ; } } else { s . append ( cb , startChar , readSize ) ; } return overrun ; }
we use this to trim the output in case of overruns
we use this to trim the output in case of overruns