4 writes to _newlineIndex
Microsoft.Extensions.AI.OpenAI (4)
src\Shared\ServerSentEvents\SseParser_1.cs (4)
137_newlineIndex = _lineBuffer.AsSpan(searchOffset, searchLength).IndexOfAny(CR, LF); 141_newlineIndex += searchOffset; 217_newlineIndex = _lineBuffer.AsSpan(searchOffset, searchLength).IndexOfAny(CR, LF); 221_newlineIndex += searchOffset;
11 references to _newlineIndex
Microsoft.Extensions.AI.OpenAI (11)
src\Shared\ServerSentEvents\SseParser_1.cs (11)
138if (_newlineIndex >= 0) 142if (_lineBuffer[_newlineIndex] is LF || // the newline is LF 143_newlineIndex - _lineOffset + 1 < _lineLength || // we must have CR and we have whatever comes after it 218if (_newlineIndex >= 0) 222if (_lineBuffer[_newlineIndex] is LF || // newline is LF 223_newlineIndex - _lineOffset + 1 < _lineLength || // newline is CR, and we have whatever comes after it 292Debug.Assert(_newlineIndex - _lineOffset < _lineLength, "Expected to be positioned at a non-empty newline"); 293return _lineBuffer.AsSpan(_newlineIndex, _lineLength - (_newlineIndex - _lineOffset)).StartsWith(CRLF) ? 2 : 1; 334ReadOnlySpan<byte> line = _lineBuffer.AsSpan(_lineOffset, _newlineIndex - _lineOffset); 392ReadOnlySpan<byte> remainder = _lineBuffer.AsSpan(_newlineIndex + newlineLength, _lineLength - line.Length - newlineLength);