To provide slightly better performance than just scanning the string it maintains a buffer of line ending positions.