3 writes to _buffer
System.Text.Json (3)
System\Text\Json\Serialization\ReadBufferState.cs (3)
46_buffer = ArrayPool<byte>.Shared.Rent(Math.Max(initialBufferSize, JsonConstants.Utf8Bom.Length)); 140_buffer = newBuffer; 184_buffer = null!;
15 references to _buffer
System.Text.Json (15)
System\Text\Json\Serialization\ReadBufferState.cs (15)
54public readonly ReadOnlySpan<byte> Bytes => _buffer.AsSpan(_offset, _count); 70int minBufferCount = fillBuffer || _unsuccessfulReadCount > UnsuccessfulReadCountThreshold ? bufferState._buffer.Length : 0; 73int bytesRead = await utf8Json.ReadAsync(bufferState._buffer.AsMemory(bufferState._count), cancellationToken).ConfigureAwait(false); 100_buffer.AsSpan(_count)); 113while (_count < _buffer.Length); 131if ((uint)_count > ((uint)_buffer.Length / 2)) 134byte[] oldBuffer = _buffer; 136byte[] newBuffer = ArrayPool<byte>.Shared.Rent((_buffer.Length < (int.MaxValue / 2)) ? _buffer.Length * 2 : int.MaxValue); 150Buffer.BlockCopy(_buffer, _offset + bytesConsumed, _buffer, 0, _count); 169Debug.Assert(_buffer.Length >= JsonConstants.Utf8Bom.Length); 170if (_buffer.AsSpan(0, _count).StartsWith(JsonConstants.Utf8Bom)) 181new Span<byte>(_buffer, 0, _maxCount).Clear(); 183byte[] toReturn = _buffer;