17 references to Utf8Bom
System.Text.Json (17)
System\Text\Json\Document\JsonDocument.Parse.cs (4)
804
ReadOnlySpan<byte> utf8Bom = JsonConstants.
Utf8Bom
;
889
int utf8BomLength = JsonConstants.
Utf8Bom
.Length;
909
Debug.Assert(rented.Length >= JsonConstants.
Utf8Bom
.Length);
918
JsonConstants.
Utf8Bom
.SequenceEqual(rented.AsSpan(0, utf8BomLength)))
System\Text\Json\Serialization\PipeReadBufferState.cs (8)
105
if (_sequence.First.Length >= JsonConstants.
Utf8Bom
.Length)
107
if (_sequence.First.Span.StartsWith(JsonConstants.
Utf8Bom
))
109
_sequence = _sequence.Slice((byte)JsonConstants.
Utf8Bom
.Length);
117
while (matched < JsonConstants.
Utf8Bom
.Length && _sequence.TryGet(ref pos, out ReadOnlyMemory<byte> mem, advance: true))
120
for (int i = 0; i < span.Length && matched < JsonConstants.
Utf8Bom
.Length; i++, matched++)
122
if (span[i] != JsonConstants.
Utf8Bom
[matched])
130
if (matched == JsonConstants.
Utf8Bom
.Length)
132
_sequence = _sequence.Slice(JsonConstants.
Utf8Bom
.Length);
System\Text\Json\Serialization\StreamReadBufferState.cs (5)
46
_buffer = ArrayPool<byte>.Shared.Rent(Math.Max(initialBufferSize, JsonConstants.
Utf8Bom
.Length));
180
Debug.Assert(_buffer.Length >= JsonConstants.
Utf8Bom
.Length);
181
if (_buffer.AsSpan(0, _count).StartsWith(JsonConstants.
Utf8Bom
))
183
_offset = (byte)JsonConstants.
Utf8Bom
.Length;
184
_count -= JsonConstants.
Utf8Bom
.Length;