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)
54
public readonly ReadOnlySpan<byte> Bytes =>
_buffer
.AsSpan(_offset, _count);
70
int minBufferCount = fillBuffer || _unsuccessfulReadCount > UnsuccessfulReadCountThreshold ? bufferState.
_buffer
.Length : 0;
73
int bytesRead = await utf8Json.ReadAsync(bufferState.
_buffer
.AsMemory(bufferState._count), cancellationToken).ConfigureAwait(false);
100
_buffer
.AsSpan(_count));
113
while (_count <
_buffer
.Length);
131
if ((uint)_count > ((uint)
_buffer
.Length / 2))
134
byte[] oldBuffer =
_buffer
;
136
byte[] newBuffer = ArrayPool<byte>.Shared.Rent((
_buffer
.Length < (int.MaxValue / 2)) ?
_buffer
.Length * 2 : int.MaxValue);
150
Buffer.BlockCopy(
_buffer
, _offset + bytesConsumed,
_buffer
, 0, _count);
169
Debug.Assert(
_buffer
.Length >= JsonConstants.Utf8Bom.Length);
170
if (
_buffer
.AsSpan(0, _count).StartsWith(JsonConstants.Utf8Bom))
181
new Span<byte>(
_buffer
, 0, _maxCount).Clear();
183
byte[] toReturn =
_buffer
;