3 writes to _buffer
System.Text.Json (3)
System\Text\Json\Serialization\StreamReadBufferState.cs (3)
46
_buffer
= ArrayPool<byte>.Shared.Rent(Math.Max(initialBufferSize, JsonConstants.Utf8Bom.Length));
143
_buffer
= newBuffer;
195
_buffer
= null!;
16 references to _buffer
System.Text.Json (16)
System\Text\Json\Serialization\StreamReadBufferState.cs (16)
55
public readonly ReadOnlySequence<byte> Bytes => new(
_buffer
.AsMemory(_offset, _count));
71
int minBufferCount = fillBuffer || _unsuccessfulReadCount > UnsuccessfulReadCountThreshold ? bufferState.
_buffer
.Length : 0;
74
int bytesRead = await stream.ReadAsync(bufferState.
_buffer
.AsMemory(bufferState._count), cancellationToken).ConfigureAwait(false);
101
_buffer
.AsSpan(_count));
114
while (_count <
_buffer
.Length);
134
if ((uint)_count > ((uint)
_buffer
.Length / 2))
137
byte[] oldBuffer =
_buffer
;
139
byte[] newBuffer = ArrayPool<byte>.Shared.Rent((
_buffer
.Length < (int.MaxValue / 2)) ?
_buffer
.Length * 2 : int.MaxValue);
153
Buffer.BlockCopy(
_buffer
, _offset + bytesConsumedInt,
_buffer
, 0, _count);
163
_buffer
.AsSpan(_offset, _count),
180
Debug.Assert(
_buffer
.Length >= JsonConstants.Utf8Bom.Length);
181
if (
_buffer
.AsSpan(0, _count).StartsWith(JsonConstants.Utf8Bom))
192
new Span<byte>(
_buffer
, 0, _maxCount).Clear();
194
byte[] toReturn =
_buffer
;