3 writes to _lineBuffer
Microsoft.Extensions.AI.OpenAI (3)
src\Shared\ServerSentEvents\SseParser_1.cs (3)
120
_lineBuffer
= ArrayPool<byte>.Shared.Rent(DefaultArrayPoolRentSize);
200
_lineBuffer
= ArrayPool<byte>.Shared.Rent(DefaultArrayPoolRentSize);
323
GrowBuffer(ref
_lineBuffer
, _lineBuffer.Length * 2);
25 references to _lineBuffer
Microsoft.Extensions.AI.OpenAI (25)
src\Shared\ServerSentEvents\SseParser_1.cs (25)
69
/// <summary>The starting offset of valid data in <see cref="
_lineBuffer
"/>.</summary>
71
/// <summary>The length of valid data in <see cref="
_lineBuffer
"/>, starting from <see cref="_lineOffset"/>.</summary>
73
/// <summary>The index in <see cref="
_lineBuffer
"/> where a newline ('\r', '\n', or "\r\n") was found.</summary>
75
/// <summary>The index in <see cref="
_lineBuffer
"/> of characters already checked for newlines.</summary>
137
_newlineIndex =
_lineBuffer
.AsSpan(searchOffset, searchLength).IndexOfAny(CR, LF);
142
if (
_lineBuffer
[_newlineIndex] is LF || // the newline is LF
180
ArrayPool<byte>.Shared.Return(
_lineBuffer
);
217
_newlineIndex =
_lineBuffer
.AsSpan(searchOffset, searchLength).IndexOfAny(CR, LF);
222
if (
_lineBuffer
[_newlineIndex] is LF || // newline is LF
260
ArrayPool<byte>.Shared.Return(
_lineBuffer
);
284
Debug.Assert(searchOffset <=
_lineBuffer
.Length, $"{searchOffset}, {
_lineBuffer
.Length}");
293
return
_lineBuffer
.AsSpan(_newlineIndex, _lineLength - (_newlineIndex - _lineOffset)).StartsWith(CRLF) ? 2 : 1;
309
if (_lineOffset + _lineLength ==
_lineBuffer
.Length)
313
_lineBuffer
.AsSpan(_lineOffset, _lineLength).CopyTo(
_lineBuffer
);
321
else if (_lineLength ==
_lineBuffer
.Length)
323
GrowBuffer(ref _lineBuffer,
_lineBuffer
.Length * 2);
334
ReadOnlySpan<byte> line =
_lineBuffer
.AsSpan(_lineOffset, _newlineIndex - _lineOffset);
392
ReadOnlySpan<byte> remainder =
_lineBuffer
.AsSpan(_newlineIndex + newlineLength, _lineLength - line.Length - newlineLength);
499
_lineBuffer
, offset,
_lineBuffer
.Length - offset);
525
new ValueTask<int>(_stream.ReadAsync(
_lineBuffer
, offset,
_lineBuffer
.Length - offset, cancellationToken))
550
if (
_lineBuffer
.AsSpan(0, _lineLength).StartsWith(Utf8Bom))