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); 323GrowBuffer(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); 142if (_lineBuffer[_newlineIndex] is LF || // the newline is LF 180ArrayPool<byte>.Shared.Return(_lineBuffer); 217_newlineIndex = _lineBuffer.AsSpan(searchOffset, searchLength).IndexOfAny(CR, LF); 222if (_lineBuffer[_newlineIndex] is LF || // newline is LF 260ArrayPool<byte>.Shared.Return(_lineBuffer); 284Debug.Assert(searchOffset <= _lineBuffer.Length, $"{searchOffset}, {_lineBuffer.Length}"); 293return _lineBuffer.AsSpan(_newlineIndex, _lineLength - (_newlineIndex - _lineOffset)).StartsWith(CRLF) ? 2 : 1; 309if (_lineOffset + _lineLength == _lineBuffer.Length) 313_lineBuffer.AsSpan(_lineOffset, _lineLength).CopyTo(_lineBuffer); 321else if (_lineLength == _lineBuffer.Length) 323GrowBuffer(ref _lineBuffer, _lineBuffer.Length * 2); 334ReadOnlySpan<byte> line = _lineBuffer.AsSpan(_lineOffset, _newlineIndex - _lineOffset); 392ReadOnlySpan<byte> remainder = _lineBuffer.AsSpan(_newlineIndex + newlineLength, _lineLength - line.Length - newlineLength); 499_lineBuffer, offset, _lineBuffer.Length - offset); 525new ValueTask<int>(_stream.ReadAsync(_lineBuffer, offset, _lineBuffer.Length - offset, cancellationToken)) 550if (_lineBuffer.AsSpan(0, _lineLength).StartsWith(Utf8Bom))