Changed to support re-entrance:

It will absorb the newline sequence, but only when it reads an entire newline sequence (either a CR, LF, or CRLF). The 'flags' parameter is used to allow this to be spread across multiple buffers.