private int ReadBufferScan(out int nlpos)
{
int total = 0;
nlpos = -1;
if (readBuffers == null) return 0;
// Yields to 0 for empty readBuffers.
foreach (var o in readBuffers)
{
var read = o.Length;
if ((nlpos == -1) && (total <= readPosition) && (total + read > readPosition))
{
// Find the first occurence of \n.
nlpos = total + FindEoln(o, readPosition - total);
}
total += read;
}
// Substract the count of data already processed.
total -= readPosition;
return total;
}