51 internal int Length {
get;
private set; }
72 if (num > 1048576 && num <= 4194304)
162 int value = num |
int.MinValue;
174 for (
int num =
Length - 12; num >= 0; num -= 12)
200 byte[]
array =
new byte[num];
364 return dbRow.SizeOrLength;
377 if (!
dbRow.HasComplexChildren)
389 if (!
dbRow.IsSimpleValue)
391 i += 12 *
dbRow.NumberOfRows;
402 if (
dbRow.IsSimpleValue)
423 if (
dbRow.IsSimpleValue)
443 if (
dbRow.IsSimpleValue)
476 if (
dbRow.HasComplexChildren)
532 int num =
span.IndexOf<
byte>(92);
553 if (
dbRow.HasComplexChildren)
722 value =
default(decimal);
737 if (
dbRow.HasComplexChildren)
761 if (
dbRow.HasComplexChildren)
785 if (
dbRow.HasComplexChildren)
821 switch (
row.TokenType)
824 writer.WriteStartObject();
860 switch (
row.TokenType)
878 writer.WriteStartObject();
901 if (!
row.HasComplexChildren)
906 int num =
span.IndexOf<
byte>(92);
985 num2 += stack.Pop().SizeOrLength;
1009 if (num + 1 !=
num3)
1101 array.AsSpan(0, num).Clear();
1258 switch (reader.TokenType)
1264 if (!reader.TrySkip())
1279 bytes = reader.OriginalSpan;
1293 if (reader.HasValueSequence)
1306 if (reader.HasValueSequence)
1320 bytes = reader.ValueSpan;
1326 if (reader.HasValueSequence)
1328 num += reader.ValueSequence.Length;
1333 bytes = reader.ValueSpan;
1342 bytes = reader.ValueSpan;
1470 byte[]
array =
null;
1496 if (
array.Length == num)
1513 array.AsSpan(0, num).Clear();
1578 if (
dbRow.NumberOfRows == 1)
1625 if (
dbRow.NumberOfRows == 1)
1642 num = ((!
dbRow.IsSimpleValue) ? (num - 12 * (
dbRow.NumberOfRows + 1)) : (num - 12));
1645 if (
dbRow.HasComplexChildren)
1654 byte[]
array =
null;
static void BlockCopy(Array src, int srcOffset, Array dst, int dstOffset, int count)
static ArrayPool< T > Shared
T[] Rent(int minimumLength)
static bool TryParse(ReadOnlySpan< byte > source, out bool value, out int bytesConsumed, char standardFormat='\0')
static byte Max(byte val1, byte val2)
static string JsonDocumentDoesNotSupportComments
static ReadOnlySpan< byte > NullValue
static ReadOnlySpan< byte > TrueValue
static ReadOnlySpan< byte > FalseValue
static ReadOnlySpan< byte > Utf8Bom
static JsonDocument Parse(ReadOnlySequence< byte > utf8Json, JsonDocumentOptions options=default(JsonDocumentOptions))
bool _hasExtraRentedArrayPoolBytes
string GetRawValueAsString(int index)
bool TryGetNamedPropertyValue(int startIndex, int endIndex, ReadOnlySpan< byte > propertyName, out JsonElement value)
bool TryGetValue(int index, out sbyte value)
JsonElement GetArrayIndexElement(int currentIndex, int arrayIndex)
int GetEndIndex(int index, bool includeEndElement)
void WriteTo(Utf8JsonWriter writer)
bool TryGetValue(int index, out ushort value)
static JsonDocument s_falseLiteral
static JsonDocument CreateForLiteral(JsonTokenType tokenType)
static JsonDocument Parse(string json, JsonDocumentOptions options=default(JsonDocumentOptions))
bool TryGetValue(int index, out DateTime value)
static JsonDocument Parse(ReadOnlyMemory< char > json, JsonDocumentOptions options=default(JsonDocumentOptions))
byte[] _extraRentedArrayPoolBytes
string GetNameOfPropertyValue(int index)
bool TryGetNamedPropertyValue(int index, ReadOnlySpan< char > propertyName, out JsonElement value)
bool TryGetValue(int index, out long value)
bool _hasExtraPooledByteBufferWriter
ReadOnlySpan< byte > UnescapeString(in DbRow row, out ArraySegment< byte > rented)
ReadOnlyMemory< byte > GetRootRawValue()
void WriteComplexElement(int index, Utf8JsonWriter writer)
static Task< JsonDocument > ParseAsync(Stream utf8Json, JsonDocumentOptions options=default(JsonDocumentOptions), CancellationToken cancellationToken=default(CancellationToken))
bool TryGetValue(int index, out double value)
bool TryGetValue(int index, out Guid value)
static JsonDocument Parse(ReadOnlyMemory< byte > utf8Json, JsonReaderOptions readerOptions, byte[] extraRentedArrayPoolBytes=null, PooledByteBufferWriter extraPooledByteBufferWriter=null)
bool TryGetValue(int index, out int value)
bool TryGetValue(int index, [NotNullWhen(true)] out byte[] value)
static JsonDocument ParseValue(ReadOnlyMemory< char > json, JsonDocumentOptions options)
ReadOnlyMemory< byte > GetPropertyRawValue(int valueIndex)
static bool TryParseValue(ref Utf8JsonReader reader, [NotNullWhen(true)] out JsonDocument? document)
static void CheckSupportedOptions(JsonReaderOptions readerOptions, string paramName)
bool TryGetNamedPropertyValue(int index, ReadOnlySpan< byte > propertyName, out JsonElement value)
bool TryGetValue(int index, out uint value)
void CheckExpectedType(JsonTokenType expected, JsonTokenType actual)
void WriteElementTo(int index, Utf8JsonWriter writer)
static async ValueTask< ArraySegment< byte > > ReadToEndAsync(Stream stream, CancellationToken cancellationToken)
ReadOnlyMemory< byte > _utf8Json
bool TextEquals(int index, ReadOnlySpan< char > otherText, bool isPropertyName)
string GetPropertyRawValueAsString(int valueIndex)
static JsonDocument Parse(Stream utf8Json, JsonDocumentOptions options=default(JsonDocumentOptions))
bool TextEquals(int index, ReadOnlySpan< byte > otherUtf8Text, bool isPropertyName, bool shouldUnescape)
static JsonDocument ParseRented(PooledByteBufferWriter utf8Json, JsonDocumentOptions options=default(JsonDocumentOptions))
PooledByteBufferWriter _extraPooledByteBufferWriter
string _lastIndexAndString
JsonElement CloneElement(int index)
int GetArrayLength(int index)
ReadOnlyMemory< byte > GetRawValue(int index, bool includeQuotes)
static JsonDocument ParseValue(ref Utf8JsonReader reader)
bool TryGetValue(int index, out ulong value)
static void ClearAndReturn(ArraySegment< byte > rented)
bool TryGetValue(int index, out byte value)
static JsonDocument Parse(ReadOnlyMemory< byte > utf8Json, JsonDocumentOptions options=default(JsonDocumentOptions))
static JsonDocument ParseValue(Stream utf8Json, JsonDocumentOptions options)
string GetString(int index, JsonTokenType expectedType)
static async Task< JsonDocument > ParseAsyncCore(Stream utf8Json, JsonDocumentOptions options=default(JsonDocumentOptions), CancellationToken cancellationToken=default(CancellationToken))
void WritePropertyName(in DbRow row, Utf8JsonWriter writer)
bool TryGetValue(int index, out decimal value)
bool TryGetValue(int index, out DateTimeOffset value)
static JsonDocument ParseUnrented(ReadOnlyMemory< byte > utf8Json, JsonReaderOptions readerOptions, JsonTokenType tokenType=JsonTokenType.None)
bool TryGetValue(int index, out float value)
static ArraySegment< byte > ReadToEnd(Stream stream)
static JsonDocument ParseValue(ReadOnlySpan< byte > utf8Json, JsonDocumentOptions options)
static JsonDocument s_nullLiteral
JsonTokenType GetJsonTokenType(int index)
JsonDocument(ReadOnlyMemory< byte > utf8Json, MetadataDb parsedData, byte[] extraRentedArrayPoolBytes=null, PooledByteBufferWriter extraPooledByteBufferWriter=null, bool isDisposable=true)
static JsonDocument ParseValue(string json, JsonDocumentOptions options)
static bool TryParseValue(ref Utf8JsonReader reader, [NotNullWhen(true)] out JsonDocument document, bool shouldThrow, bool useArrayPools)
static JsonDocument s_trueLiteral
void WriteString(in DbRow row, Utf8JsonWriter writer)
bool TryGetValue(int index, out short value)
static void Parse(ReadOnlySpan< byte > utf8JsonSpan, JsonReaderOptions readerOptions, ref MetadataDb database, ref StackRowStack stack)
static bool IsValidDateTimeOffsetParseLength(int length)
static bool TryParseAsISO(ReadOnlySpan< byte > source, out DateTime value)
static bool TryGetEscapedDateTime(ReadOnlySpan< byte > source, out DateTime value)
static string TranscodeHelper(ReadOnlySpan< byte > utf8Unescaped)
static string GetUnescapedString(ReadOnlySpan< byte > utf8Source, int idx)
static bool TryGetEscapedDateTimeOffset(ReadOnlySpan< byte > source, out DateTimeOffset value)
static bool UnescapeAndCompare(ReadOnlySpan< byte > utf8Source, ReadOnlySpan< byte > other)
static bool TryGetEscapedGuid(ReadOnlySpan< byte > source, out Guid value)
static int GetUtf8FromText(ReadOnlySpan< char > text, Span< byte > dest)
static void Unescape(ReadOnlySpan< byte > source, Span< byte > destination, int idx, out int written)
static bool TryGetUnescapedBase64Bytes(ReadOnlySpan< byte > utf8Source, int idx, [NotNullWhen(true)] out byte[] bytes)
static readonly UTF8Encoding s_utf8Encoding
static bool TryDecodeBase64(ReadOnlySpan< byte > utf8Unescaped, [NotNullWhen(true)] out byte[] bytes)
static int GetUtf8ByteCount(ReadOnlySpan< char > text)
static unsafe OperationStatus ToUtf8(ReadOnlySpan< byte > utf16Source, Span< byte > utf8Destination, out int bytesConsumed, out int bytesWritten)
static void ThrowJsonReaderException(ref Utf8JsonReader json, ExceptionResource resource, byte nextByte=0, ReadOnlySpan< byte > bytes=default(ReadOnlySpan< byte >))
static InvalidOperationException GetJsonElementWrongTypeException(JsonTokenType expectedType, JsonTokenType actualType)
static int Exchange(ref int location1, int value)
ReadOnlySequence< T > Slice(long start, long length)
unsafe ReadOnlySpan< T > Span
ReadOnlyMemory< T > Slice(int start)
static ReadOnlyMemory< T > Empty
ReadOnlySpan< T > Slice(int start)
void CopyTo(Span< T > destination)
readonly int _numberOfRowsAndTypeUnion
readonly int _sizeOrLengthUnion
DbRow(JsonTokenType jsonTokenType, int location, int sizeOrLength)
void CompleteAllocations()
void Append(JsonTokenType tokenType, int startLocation, int length)
static MetadataDb CreateLocked(int payloadLength)
MetadataDb CopySegment(int startIndex, int endIndex)
static MetadataDb CreateRented(int payloadLength, bool convertToAlloc)
int FindOpenElement(JsonTokenType lookupType)
void SetLength(int index, int length)
MetadataDb(byte[] initialDb, bool isLocked, bool convertToAlloc)
MetadataDb(byte[] completeDb)
void SetNumberOfRows(int index, int numberOfRows)
int FindIndexOfFirstUnsetSizeOrLength(JsonTokenType lookupType)
void SetHasComplexChildren(int index)
JsonTokenType GetJsonTokenType(int index)
StackRowStack(int initialSize)
StackRow(int sizeOrLength=0, int numberOfRows=-1)
void WriteTo(Utf8JsonWriter writer)