17 references to Utf8Bom
System.Text.Json (17)
System\Text\Json\Document\JsonDocument.Parse.cs (4)
804ReadOnlySpan<byte> utf8Bom = JsonConstants.Utf8Bom; 889int utf8BomLength = JsonConstants.Utf8Bom.Length; 909Debug.Assert(rented.Length >= JsonConstants.Utf8Bom.Length); 918JsonConstants.Utf8Bom.SequenceEqual(rented.AsSpan(0, utf8BomLength)))
System\Text\Json\Serialization\PipeReadBufferState.cs (8)
85if (_sequence.First.Length >= JsonConstants.Utf8Bom.Length) 87if (_sequence.First.Span.StartsWith(JsonConstants.Utf8Bom)) 89_sequence = _sequence.Slice((byte)JsonConstants.Utf8Bom.Length); 97while (matched < JsonConstants.Utf8Bom.Length && _sequence.TryGet(ref pos, out ReadOnlyMemory<byte> mem, advance: true)) 100for (int i = 0; i < span.Length && matched < JsonConstants.Utf8Bom.Length; i++, matched++) 102if (span[i] != JsonConstants.Utf8Bom[matched]) 110if (matched == JsonConstants.Utf8Bom.Length) 112_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)); 170Debug.Assert(_buffer.Length >= JsonConstants.Utf8Bom.Length); 171if (_buffer.AsSpan(0, _count).StartsWith(JsonConstants.Utf8Bom)) 173_offset = (byte)JsonConstants.Utf8Bom.Length; 174_count -= JsonConstants.Utf8Bom.Length;