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)
138
if (
_newlineIndex
>= 0)
142
if (_lineBuffer[
_newlineIndex
] is LF || // the newline is LF
143
_newlineIndex
- _lineOffset + 1 < _lineLength || // we must have CR and we have whatever comes after it
218
if (
_newlineIndex
>= 0)
222
if (_lineBuffer[
_newlineIndex
] is LF || // newline is LF
223
_newlineIndex
- _lineOffset + 1 < _lineLength || // newline is CR, and we have whatever comes after it
292
Debug.Assert(
_newlineIndex
- _lineOffset < _lineLength, "Expected to be positioned at a non-empty newline");
293
return _lineBuffer.AsSpan(
_newlineIndex
, _lineLength - (
_newlineIndex
- _lineOffset)).StartsWith(CRLF) ? 2 : 1;
334
ReadOnlySpan<byte> line = _lineBuffer.AsSpan(_lineOffset,
_newlineIndex
- _lineOffset);
392
ReadOnlySpan<byte> remainder = _lineBuffer.AsSpan(
_newlineIndex
+ newlineLength, _lineLength - line.Length - newlineLength);