private void ShiftBufferIfNeeded()
{
// once in the last 10% of the buffer shift the remaining content to the start to avoid
// unnessesarly increasing the buffer size when reading numbers/strings
int length = _chars.Length;
if (length - _charPos <= length * 0.1)
{
int count = _charsUsed - _charPos;
if (count > 0)
{
BlockCopyChars(_chars, _charPos, _chars, 0, count);
}
_lineStartPos -= _charPos;
_charPos = 0;
_charsUsed = count;
_chars[_charsUsed] = '\0';
}
}