Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
Utf8JsonWriter.cs
Go to the documentation of this file.
4using System.IO;
9
10namespace System.Text.Json;
11
12[DebuggerDisplay("{DebuggerDisplay,nq}")]
14{
15 private static readonly int s_newLineLength = Environment.NewLine.Length;
16
18
19 private Stream _stream;
20
22
24
25 private bool _inObject;
26
28
30
31 private int _currentDepth;
32
34
35 private static readonly char[] s_singleLineCommentDelimiter = new char[2] { '*', '/' };
36
37 public int BytesPending { get; private set; }
38
39 public long BytesCommitted { get; private set; }
40
42
43 private int Indentation => CurrentDepth * 2;
44
46
47 public int CurrentDepth => _currentDepth & 0x7FFFFFFF;
48
50 private string DebuggerDisplay => $"BytesCommitted = {BytesCommitted} BytesPending = {BytesPending} CurrentDepth = {CurrentDepth}";
51
53
59
61 {
62 if (utf8Json == null)
63 {
64 throw new ArgumentNullException("utf8Json");
65 }
66 if (!utf8Json.CanWrite)
67 {
69 }
73 }
74
75 public void Reset()
76 {
80 }
81
82 public void Reset(Stream utf8Json)
83 {
85 if (utf8Json == null)
86 {
87 throw new ArgumentNullException("utf8Json");
88 }
89 if (!utf8Json.CanWrite)
90 {
92 }
94 if (_arrayBufferWriter == null)
95 {
97 }
98 else
99 {
101 }
102 _output = null;
103 ResetHelper();
104 }
105
107 {
109 _output = bufferWriter ?? throw new ArgumentNullException("bufferWriter");
110 _stream = null;
111 _arrayBufferWriter = null;
112 ResetHelper();
113 }
114
115 private void ResetHelper()
116 {
117 BytesPending = 0;
118 BytesCommitted = 0L;
119 _memory = default(Memory<byte>);
120 _inObject = false;
122 _currentDepth = 0;
123 _bitStack = default(BitStack);
124 }
125
126 private void CheckNotDisposed()
127 {
128 if (_stream == null && _output == null)
129 {
130 throw new ObjectDisposedException("Utf8JsonWriter");
131 }
132 }
133
134 public void Flush()
135 {
137 _memory = default(Memory<byte>);
138 if (_stream != null)
139 {
140 if (BytesPending != 0)
141 {
143 BytesPending = 0;
147 }
148 _stream.Flush();
149 }
150 else if (BytesPending != 0)
151 {
154 BytesPending = 0;
155 }
156 }
157
158 public void Dispose()
159 {
160 if (_stream != null || _output != null)
161 {
162 Flush();
163 ResetHelper();
164 _stream = null;
165 _arrayBufferWriter = null;
166 _output = null;
167 }
168 }
169
171 {
172 if (_stream != null || _output != null)
173 {
175 ResetHelper();
176 _stream = null;
177 _arrayBufferWriter = null;
178 _output = null;
179 }
180 }
181
205
206 public void WriteStartArray()
207 {
208 WriteStart(91);
209 _tokenType = JsonTokenType.StartArray;
210 }
211
212 public void WriteStartObject()
213 {
214 WriteStart(123);
215 _tokenType = JsonTokenType.StartObject;
216 }
217
218 private void WriteStart(byte token)
219 {
220 if (CurrentDepth >= 1000)
221 {
223 }
225 {
226 WriteStartSlow(token);
227 }
228 else
229 {
230 WriteStartMinimized(token);
231 }
232 _currentDepth &= int.MaxValue;
234 }
235
236 private void WriteStartMinimized(byte token)
237 {
238 if (_memory.Length - BytesPending < 2)
239 {
240 Grow(2);
241 }
243 if (_currentDepth < 0)
244 {
245 span[BytesPending++] = 44;
246 }
247 span[BytesPending++] = token;
248 }
249
250 private void WriteStartSlow(byte token)
251 {
252 if (_options.Indented)
253 {
255 {
258 }
259 WriteStartIndented(token);
260 }
261 else
262 {
265 WriteStartMinimized(token);
266 }
267 }
268
269 private void ValidateStart()
270 {
271 if (_inObject)
272 {
273 if (_tokenType != JsonTokenType.PropertyName)
274 {
275 ThrowHelper.ThrowInvalidOperationException(ExceptionResource.CannotStartObjectArrayWithoutProperty, 0, 0, _tokenType);
276 }
277 }
278 else if (CurrentDepth == 0 && _tokenType != 0)
279 {
280 ThrowHelper.ThrowInvalidOperationException(ExceptionResource.CannotStartObjectArrayAfterPrimitiveOrClose, 0, 0, _tokenType);
281 }
282 }
283
284 private void WriteStartIndented(byte token)
285 {
287 int num = indentation + 1;
288 int num2 = num + 3;
290 {
291 Grow(num2);
292 }
294 if (_currentDepth < 0)
295 {
296 span[BytesPending++] = 44;
297 }
298 if (_tokenType != JsonTokenType.PropertyName)
299 {
300 if (_tokenType != 0)
301 {
303 }
306 }
307 span[BytesPending++] = token;
308 }
309
311 {
312 WriteStartHelper(propertyName.EncodedUtf8Bytes, 91);
313 _tokenType = JsonTokenType.StartArray;
314 }
315
317 {
318 WriteStartHelper(propertyName.EncodedUtf8Bytes, 123);
319 _tokenType = JsonTokenType.StartObject;
320 }
321
323 {
326 _currentDepth &= int.MaxValue;
328 }
329
338
347
349 {
351 if (num != -1)
352 {
354 }
355 else
356 {
358 }
359 }
360
362 {
364 if (_options.Indented)
365 {
367 }
368 else
369 {
371 }
372 }
373
387
388 public void WriteStartArray(string propertyName)
389 {
390 WriteStartArray((propertyName ?? throw new ArgumentNullException("propertyName")).AsSpan());
391 }
392
393 public void WriteStartObject(string propertyName)
394 {
395 WriteStartObject((propertyName ?? throw new ArgumentNullException("propertyName")).AsSpan());
396 }
397
406
415
417 {
419 if (num != -1)
420 {
422 }
423 else
424 {
426 }
427 }
428
430 {
432 if (_options.Indented)
433 {
435 }
436 else
437 {
439 }
440 }
441
455
456 public void WriteEndArray()
457 {
458 WriteEnd(93);
459 _tokenType = JsonTokenType.EndArray;
460 }
461
462 public void WriteEndObject()
463 {
464 WriteEnd(125);
465 _tokenType = JsonTokenType.EndObject;
466 }
467
468 private void WriteEnd(byte token)
469 {
471 {
472 WriteEndSlow(token);
473 }
474 else
475 {
476 WriteEndMinimized(token);
477 }
479 if (CurrentDepth != 0)
480 {
482 }
483 }
484
485 private void WriteEndMinimized(byte token)
486 {
487 if (_memory.Length - BytesPending < 1)
488 {
489 Grow(1);
490 }
491 _memory.Span[BytesPending++] = token;
492 }
493
494 private void WriteEndSlow(byte token)
495 {
496 if (_options.Indented)
497 {
499 {
500 ValidateEnd(token);
501 }
502 WriteEndIndented(token);
503 }
504 else
505 {
506 ValidateEnd(token);
507 WriteEndMinimized(token);
508 }
509 }
510
511 private void ValidateEnd(byte token)
512 {
513 if (_bitStack.CurrentDepth <= 0 || _tokenType == JsonTokenType.PropertyName)
514 {
516 }
517 if (token == 93)
518 {
519 if (_inObject)
520 {
522 }
523 }
524 else if (!_inObject)
525 {
527 }
529 }
530
531 private void WriteEndIndented(byte token)
532 {
533 if (_tokenType == JsonTokenType.StartObject || _tokenType == JsonTokenType.StartArray)
534 {
535 WriteEndMinimized(token);
536 return;
537 }
538 int num = Indentation;
539 if (num != 0)
540 {
541 num -= 2;
542 }
543 int num2 = num + 3;
545 {
546 Grow(num2);
547 }
551 BytesPending += num;
552 span[BytesPending++] = token;
553 }
554
555 [MethodImpl(MethodImplOptions.AggressiveInlining)]
557 {
558 if (s_newLineLength == 2)
559 {
560 output[BytesPending++] = 13;
561 }
562 output[BytesPending++] = 10;
563 }
564
565 [MethodImpl(MethodImplOptions.AggressiveInlining)]
566 private void UpdateBitStackOnStart(byte token)
567 {
568 if (token == 91)
569 {
571 _inObject = false;
572 }
573 else
574 {
576 _inObject = true;
577 }
578 }
579
580 private void Grow(int requiredSize)
581 {
582 if (_memory.Length == 0)
583 {
585 return;
586 }
587 int num = Math.Max(4096, requiredSize);
588 if (_stream != null)
589 {
590 int num2 = BytesPending + num;
593 return;
594 }
597 BytesPending = 0;
599 if (_memory.Length < num)
600 {
602 }
603 }
604
606 {
607 int num = Math.Max(256, requiredSize);
608 if (_stream != null)
609 {
611 return;
612 }
614 if (_memory.Length < num)
615 {
617 }
618 }
619
621 {
622 _currentDepth |= int.MinValue;
623 }
624
633
635 {
636 WriteBase64String((propertyName ?? throw new ArgumentNullException("propertyName")).AsSpan(), bytes);
637 }
638
646
654
667
680
694
708
721
734
756
779
809
840
848
850 {
851 WriteString((propertyName ?? throw new ArgumentNullException("propertyName")).AsSpan(), value);
852 }
853
861
869
882
895
909
923
936
949
951 {
952 int num = escapedPropertyName.Length * 3 + 33 + 6;
953 if (_memory.Length - BytesPending < num)
954 {
955 Grow(num);
956 }
958 if (_currentDepth < 0)
959 {
960 span[BytesPending++] = 44;
961 }
962 span[BytesPending++] = 34;
964 span[BytesPending++] = 34;
965 span[BytesPending++] = 58;
966 span[BytesPending++] = 34;
969 span[BytesPending++] = 34;
970 }
971
973 {
974 int num = escapedPropertyName.Length + 33 + 5;
975 int num2 = num + 1;
977 {
978 Grow(num2);
979 }
981 if (_currentDepth < 0)
982 {
983 span[BytesPending++] = 44;
984 }
985 span[BytesPending++] = 34;
988 span[BytesPending++] = 34;
989 span[BytesPending++] = 58;
990 span[BytesPending++] = 34;
993 span[BytesPending++] = 34;
994 }
995
997 {
999 int num = indentation + escapedPropertyName.Length * 3 + 33 + 7 + s_newLineLength;
1000 if (_memory.Length - BytesPending < num)
1001 {
1002 Grow(num);
1003 }
1005 if (_currentDepth < 0)
1006 {
1007 span[BytesPending++] = 44;
1008 }
1009 if (_tokenType != 0)
1010 {
1012 }
1015 span[BytesPending++] = 34;
1017 span[BytesPending++] = 34;
1018 span[BytesPending++] = 58;
1019 span[BytesPending++] = 32;
1020 span[BytesPending++] = 34;
1023 span[BytesPending++] = 34;
1024 }
1025
1027 {
1029 int num = indentation + escapedPropertyName.Length + 33 + 6;
1030 int num2 = num + 1 + s_newLineLength;
1032 {
1033 Grow(num2);
1034 }
1036 if (_currentDepth < 0)
1037 {
1038 span[BytesPending++] = 44;
1039 }
1040 if (_tokenType != 0)
1041 {
1043 }
1046 span[BytesPending++] = 34;
1047 escapedPropertyName.CopyTo(span.Slice(BytesPending));
1049 span[BytesPending++] = 34;
1050 span[BytesPending++] = 58;
1051 span[BytesPending++] = 32;
1052 span[BytesPending++] = 34;
1055 span[BytesPending++] = 34;
1056 }
1057
1064
1072
1074 {
1075 WriteString((propertyName ?? throw new ArgumentNullException("propertyName")).AsSpan(), value);
1076 }
1077
1085
1093
1095 {
1097 if (num != -1)
1098 {
1100 }
1101 else
1102 {
1104 }
1105 }
1106
1119
1133
1147
1160
1173
1175 {
1176 int num = escapedPropertyName.Length * 3 + 33 + 6;
1177 if (_memory.Length - BytesPending < num)
1178 {
1179 Grow(num);
1180 }
1182 if (_currentDepth < 0)
1183 {
1184 span[BytesPending++] = 44;
1185 }
1186 span[BytesPending++] = 34;
1188 span[BytesPending++] = 34;
1189 span[BytesPending++] = 58;
1190 span[BytesPending++] = 34;
1193 span[BytesPending++] = 34;
1194 }
1195
1197 {
1198 int num = escapedPropertyName.Length + 33 + 5;
1199 int num2 = num + 1;
1201 {
1202 Grow(num2);
1203 }
1205 if (_currentDepth < 0)
1206 {
1207 span[BytesPending++] = 44;
1208 }
1209 span[BytesPending++] = 34;
1210 escapedPropertyName.CopyTo(span.Slice(BytesPending));
1212 span[BytesPending++] = 34;
1213 span[BytesPending++] = 58;
1214 span[BytesPending++] = 34;
1217 span[BytesPending++] = 34;
1218 }
1219
1221 {
1223 int num = indentation + escapedPropertyName.Length * 3 + 33 + 7 + s_newLineLength;
1224 if (_memory.Length - BytesPending < num)
1225 {
1226 Grow(num);
1227 }
1229 if (_currentDepth < 0)
1230 {
1231 span[BytesPending++] = 44;
1232 }
1233 if (_tokenType != 0)
1234 {
1236 }
1239 span[BytesPending++] = 34;
1241 span[BytesPending++] = 34;
1242 span[BytesPending++] = 58;
1243 span[BytesPending++] = 32;
1244 span[BytesPending++] = 34;
1247 span[BytesPending++] = 34;
1248 }
1249
1251 {
1253 int num = indentation + escapedPropertyName.Length + 33 + 6;
1254 int num2 = num + 1 + s_newLineLength;
1256 {
1257 Grow(num2);
1258 }
1260 if (_currentDepth < 0)
1261 {
1262 span[BytesPending++] = 44;
1263 }
1264 if (_tokenType != 0)
1265 {
1267 }
1270 span[BytesPending++] = 34;
1271 escapedPropertyName.CopyTo(span.Slice(BytesPending));
1273 span[BytesPending++] = 34;
1274 span[BytesPending++] = 58;
1275 span[BytesPending++] = 32;
1276 span[BytesPending++] = 34;
1279 span[BytesPending++] = 34;
1280 }
1281
1288
1296
1297 public void WriteNumber(string propertyName, decimal value)
1298 {
1299 WriteNumber((propertyName ?? throw new ArgumentNullException("propertyName")).AsSpan(), value);
1300 }
1301
1309
1317
1319 {
1321 if (num != -1)
1322 {
1324 }
1325 else
1326 {
1328 }
1329 }
1330
1332 {
1334 if (num != -1)
1335 {
1337 }
1338 else
1339 {
1341 }
1342 }
1343
1357
1371
1373 {
1375 if (_options.Indented)
1376 {
1378 }
1379 else
1380 {
1382 }
1383 }
1384
1386 {
1388 if (_options.Indented)
1389 {
1391 }
1392 else
1393 {
1395 }
1396 }
1397
1399 {
1400 int num = escapedPropertyName.Length * 3 + 31 + 4;
1401 if (_memory.Length - BytesPending < num)
1402 {
1403 Grow(num);
1404 }
1406 if (_currentDepth < 0)
1407 {
1408 span[BytesPending++] = 44;
1409 }
1410 span[BytesPending++] = 34;
1412 span[BytesPending++] = 34;
1413 span[BytesPending++] = 58;
1414 int bytesWritten;
1417 }
1418
1420 {
1421 int num = escapedPropertyName.Length + 31 + 3;
1422 int num2 = num + 1;
1424 {
1425 Grow(num2);
1426 }
1428 if (_currentDepth < 0)
1429 {
1430 span[BytesPending++] = 44;
1431 }
1432 span[BytesPending++] = 34;
1433 escapedPropertyName.CopyTo(span.Slice(BytesPending));
1435 span[BytesPending++] = 34;
1436 span[BytesPending++] = 58;
1437 int bytesWritten;
1440 }
1441
1443 {
1445 int num = indentation + escapedPropertyName.Length * 3 + 31 + 5 + s_newLineLength;
1446 if (_memory.Length - BytesPending < num)
1447 {
1448 Grow(num);
1449 }
1451 if (_currentDepth < 0)
1452 {
1453 span[BytesPending++] = 44;
1454 }
1455 if (_tokenType != 0)
1456 {
1458 }
1461 span[BytesPending++] = 34;
1463 span[BytesPending++] = 34;
1464 span[BytesPending++] = 58;
1465 span[BytesPending++] = 32;
1466 int bytesWritten;
1469 }
1470
1472 {
1474 int num = indentation + escapedPropertyName.Length + 31 + 4;
1475 int num2 = num + 1 + s_newLineLength;
1477 {
1478 Grow(num2);
1479 }
1481 if (_currentDepth < 0)
1482 {
1483 span[BytesPending++] = 44;
1484 }
1485 if (_tokenType != 0)
1486 {
1488 }
1491 span[BytesPending++] = 34;
1492 escapedPropertyName.CopyTo(span.Slice(BytesPending));
1494 span[BytesPending++] = 34;
1495 span[BytesPending++] = 58;
1496 span[BytesPending++] = 32;
1497 int bytesWritten;
1500 }
1501
1502 internal void WritePropertyName(decimal value)
1503 {
1505 int bytesWritten;
1508 }
1509
1518
1519 public void WriteNumber(string propertyName, double value)
1520 {
1521 WriteNumber((propertyName ?? throw new ArgumentNullException("propertyName")).AsSpan(), value);
1522 }
1523
1532
1541
1543 {
1545 if (num != -1)
1546 {
1548 }
1549 else
1550 {
1552 }
1553 }
1554
1556 {
1558 if (num != -1)
1559 {
1561 }
1562 else
1563 {
1565 }
1566 }
1567
1581
1595
1597 {
1599 if (_options.Indented)
1600 {
1602 }
1603 else
1604 {
1606 }
1607 }
1608
1621
1623 {
1624 int num = escapedPropertyName.Length * 3 + 128 + 4;
1625 if (_memory.Length - BytesPending < num)
1626 {
1627 Grow(num);
1628 }
1630 if (_currentDepth < 0)
1631 {
1632 span[BytesPending++] = 44;
1633 }
1634 span[BytesPending++] = 34;
1636 span[BytesPending++] = 34;
1637 span[BytesPending++] = 58;
1638 int bytesWritten;
1639 bool flag = TryFormatDouble(value, span.Slice(BytesPending), out bytesWritten);
1641 }
1642
1644 {
1645 int num = escapedPropertyName.Length + 128 + 3;
1646 int num2 = num + 1;
1648 {
1649 Grow(num2);
1650 }
1652 if (_currentDepth < 0)
1653 {
1654 span[BytesPending++] = 44;
1655 }
1656 span[BytesPending++] = 34;
1657 escapedPropertyName.CopyTo(span.Slice(BytesPending));
1659 span[BytesPending++] = 34;
1660 span[BytesPending++] = 58;
1661 int bytesWritten;
1662 bool flag = TryFormatDouble(value, span.Slice(BytesPending), out bytesWritten);
1664 }
1665
1667 {
1669 int num = indentation + escapedPropertyName.Length * 3 + 128 + 5 + s_newLineLength;
1670 if (_memory.Length - BytesPending < num)
1671 {
1672 Grow(num);
1673 }
1675 if (_currentDepth < 0)
1676 {
1677 span[BytesPending++] = 44;
1678 }
1679 if (_tokenType != 0)
1680 {
1682 }
1685 span[BytesPending++] = 34;
1687 span[BytesPending++] = 34;
1688 span[BytesPending++] = 58;
1689 span[BytesPending++] = 32;
1690 int bytesWritten;
1691 bool flag = TryFormatDouble(value, span.Slice(BytesPending), out bytesWritten);
1693 }
1694
1696 {
1698 int num = indentation + escapedPropertyName.Length + 128 + 4;
1699 int num2 = num + 1 + s_newLineLength;
1701 {
1702 Grow(num2);
1703 }
1705 if (_currentDepth < 0)
1706 {
1707 span[BytesPending++] = 44;
1708 }
1709 if (_tokenType != 0)
1710 {
1712 }
1715 span[BytesPending++] = 34;
1716 escapedPropertyName.CopyTo(span.Slice(BytesPending));
1718 span[BytesPending++] = 34;
1719 span[BytesPending++] = 58;
1720 span[BytesPending++] = 32;
1721 int bytesWritten;
1722 bool flag = TryFormatDouble(value, span.Slice(BytesPending), out bytesWritten);
1724 }
1725
1734
1743
1744 public void WriteNumber(string propertyName, float value)
1745 {
1746 WriteNumber((propertyName ?? throw new ArgumentNullException("propertyName")).AsSpan(), value);
1747 }
1748
1757
1766
1768 {
1770 if (num != -1)
1771 {
1773 }
1774 else
1775 {
1777 }
1778 }
1779
1781 {
1783 if (num != -1)
1784 {
1786 }
1787 else
1788 {
1790 }
1791 }
1792
1806
1820
1822 {
1824 if (_options.Indented)
1825 {
1827 }
1828 else
1829 {
1831 }
1832 }
1833
1846
1848 {
1849 int num = escapedPropertyName.Length * 3 + 128 + 4;
1850 if (_memory.Length - BytesPending < num)
1851 {
1852 Grow(num);
1853 }
1855 if (_currentDepth < 0)
1856 {
1857 span[BytesPending++] = 44;
1858 }
1859 span[BytesPending++] = 34;
1861 span[BytesPending++] = 34;
1862 span[BytesPending++] = 58;
1863 int bytesWritten;
1864 bool flag = TryFormatSingle(value, span.Slice(BytesPending), out bytesWritten);
1866 }
1867
1869 {
1870 int num = escapedPropertyName.Length + 128 + 3;
1871 int num2 = num + 1;
1873 {
1874 Grow(num2);
1875 }
1877 if (_currentDepth < 0)
1878 {
1879 span[BytesPending++] = 44;
1880 }
1881 span[BytesPending++] = 34;
1882 escapedPropertyName.CopyTo(span.Slice(BytesPending));
1884 span[BytesPending++] = 34;
1885 span[BytesPending++] = 58;
1886 int bytesWritten;
1887 bool flag = TryFormatSingle(value, span.Slice(BytesPending), out bytesWritten);
1889 }
1890
1892 {
1894 int num = indentation + escapedPropertyName.Length * 3 + 128 + 5 + s_newLineLength;
1895 if (_memory.Length - BytesPending < num)
1896 {
1897 Grow(num);
1898 }
1900 if (_currentDepth < 0)
1901 {
1902 span[BytesPending++] = 44;
1903 }
1904 if (_tokenType != 0)
1905 {
1907 }
1910 span[BytesPending++] = 34;
1912 span[BytesPending++] = 34;
1913 span[BytesPending++] = 58;
1914 span[BytesPending++] = 32;
1915 int bytesWritten;
1916 bool flag = TryFormatSingle(value, span.Slice(BytesPending), out bytesWritten);
1918 }
1919
1921 {
1923 int num = indentation + escapedPropertyName.Length + 128 + 4;
1924 int num2 = num + 1 + s_newLineLength;
1926 {
1927 Grow(num2);
1928 }
1930 if (_currentDepth < 0)
1931 {
1932 span[BytesPending++] = 44;
1933 }
1934 if (_tokenType != 0)
1935 {
1937 }
1940 span[BytesPending++] = 34;
1941 escapedPropertyName.CopyTo(span.Slice(BytesPending));
1943 span[BytesPending++] = 34;
1944 span[BytesPending++] = 58;
1945 span[BytesPending++] = 32;
1946 int bytesWritten;
1947 bool flag = TryFormatSingle(value, span.Slice(BytesPending), out bytesWritten);
1949 }
1950
1951 internal void WritePropertyName(float value)
1952 {
1953 Span<byte> destination = stackalloc byte[128];
1954 int bytesWritten;
1957 }
1958
1966
1967 public void WriteString(string propertyName, Guid value)
1968 {
1969 WriteString((propertyName ?? throw new ArgumentNullException("propertyName")).AsSpan(), value);
1970 }
1971
1979
1987
1989 {
1991 if (num != -1)
1992 {
1994 }
1995 else
1996 {
1998 }
1999 }
2000
2002 {
2004 if (num != -1)
2005 {
2007 }
2008 else
2009 {
2011 }
2012 }
2013
2027
2041
2054
2067
2069 {
2070 int num = escapedPropertyName.Length * 3 + 36 + 6;
2071 if (_memory.Length - BytesPending < num)
2072 {
2073 Grow(num);
2074 }
2076 if (_currentDepth < 0)
2077 {
2078 span[BytesPending++] = 44;
2079 }
2080 span[BytesPending++] = 34;
2082 span[BytesPending++] = 34;
2083 span[BytesPending++] = 58;
2084 span[BytesPending++] = 34;
2085 int bytesWritten;
2088 span[BytesPending++] = 34;
2089 }
2090
2092 {
2093 int num = escapedPropertyName.Length + 36 + 5;
2094 int num2 = num + 1;
2096 {
2097 Grow(num2);
2098 }
2100 if (_currentDepth < 0)
2101 {
2102 span[BytesPending++] = 44;
2103 }
2104 span[BytesPending++] = 34;
2105 escapedPropertyName.CopyTo(span.Slice(BytesPending));
2107 span[BytesPending++] = 34;
2108 span[BytesPending++] = 58;
2109 span[BytesPending++] = 34;
2110 int bytesWritten;
2113 span[BytesPending++] = 34;
2114 }
2115
2117 {
2119 int num = indentation + escapedPropertyName.Length * 3 + 36 + 7 + s_newLineLength;
2120 if (_memory.Length - BytesPending < num)
2121 {
2122 Grow(num);
2123 }
2125 if (_currentDepth < 0)
2126 {
2127 span[BytesPending++] = 44;
2128 }
2129 if (_tokenType != 0)
2130 {
2132 }
2135 span[BytesPending++] = 34;
2137 span[BytesPending++] = 34;
2138 span[BytesPending++] = 58;
2139 span[BytesPending++] = 32;
2140 span[BytesPending++] = 34;
2141 int bytesWritten;
2144 span[BytesPending++] = 34;
2145 }
2146
2148 {
2150 int num = indentation + escapedPropertyName.Length + 36 + 6;
2151 int num2 = num + 1 + s_newLineLength;
2153 {
2154 Grow(num2);
2155 }
2157 if (_currentDepth < 0)
2158 {
2159 span[BytesPending++] = 44;
2160 }
2161 if (_tokenType != 0)
2162 {
2164 }
2167 span[BytesPending++] = 34;
2168 escapedPropertyName.CopyTo(span.Slice(BytesPending));
2170 span[BytesPending++] = 34;
2171 span[BytesPending++] = 58;
2172 span[BytesPending++] = 32;
2173 span[BytesPending++] = 34;
2174 int bytesWritten;
2177 span[BytesPending++] = 34;
2178 }
2179
2187
2188 [MethodImpl(MethodImplOptions.AggressiveInlining)]
2196
2197 [MethodImpl(MethodImplOptions.AggressiveInlining)]
2205
2206 [MethodImpl(MethodImplOptions.AggressiveInlining)]
2207 private void ValidateDepth()
2208 {
2209 if (CurrentDepth >= 1000)
2210 {
2212 }
2213 }
2214
2215 [MethodImpl(MethodImplOptions.AggressiveInlining)]
2217 {
2218 if (!_options.SkipValidation && (!_inObject || _tokenType == JsonTokenType.PropertyName))
2219 {
2220 ThrowHelper.ThrowInvalidOperationException(ExceptionResource.CannotWritePropertyWithinArray, 0, 0, _tokenType);
2221 }
2222 }
2223
2224 [MethodImpl(MethodImplOptions.AggressiveInlining)]
2225 private void ValidateWritingProperty(byte token)
2226 {
2228 {
2229 if (!_inObject || _tokenType == JsonTokenType.PropertyName)
2230 {
2231 ThrowHelper.ThrowInvalidOperationException(ExceptionResource.CannotWritePropertyWithinArray, 0, 0, _tokenType);
2232 }
2233 UpdateBitStackOnStart(token);
2234 }
2235 }
2236
2238 {
2239 int num = escapedPropertyName.Length + 4;
2240 int num2 = num + 1;
2242 {
2243 Grow(num2);
2244 }
2246 if (_currentDepth < 0)
2247 {
2248 span[BytesPending++] = 44;
2249 }
2250 span[BytesPending++] = 34;
2251 escapedPropertyName.CopyTo(span.Slice(BytesPending));
2253 span[BytesPending++] = 34;
2254 span[BytesPending++] = 58;
2255 span[BytesPending++] = token;
2256 }
2257
2259 {
2262 int num2 = num + 1 + s_newLineLength;
2264 {
2265 Grow(num2);
2266 }
2268 if (_currentDepth < 0)
2269 {
2270 span[BytesPending++] = 44;
2271 }
2272 if (_tokenType != 0)
2273 {
2275 }
2278 span[BytesPending++] = 34;
2279 escapedPropertyName.CopyTo(span.Slice(BytesPending));
2281 span[BytesPending++] = 34;
2282 span[BytesPending++] = 58;
2283 span[BytesPending++] = 32;
2284 span[BytesPending++] = token;
2285 }
2286
2288 {
2289 int num = escapedPropertyName.Length * 3 + 5;
2290 if (_memory.Length - BytesPending < num)
2291 {
2292 Grow(num);
2293 }
2295 if (_currentDepth < 0)
2296 {
2297 span[BytesPending++] = 44;
2298 }
2299 span[BytesPending++] = 34;
2301 span[BytesPending++] = 34;
2302 span[BytesPending++] = 58;
2303 span[BytesPending++] = token;
2304 }
2305
2307 {
2310 if (_memory.Length - BytesPending < num)
2311 {
2312 Grow(num);
2313 }
2315 if (_currentDepth < 0)
2316 {
2317 span[BytesPending++] = 44;
2318 }
2319 if (_tokenType != 0)
2320 {
2322 }
2325 span[BytesPending++] = 34;
2327 span[BytesPending++] = 34;
2328 span[BytesPending++] = 58;
2329 span[BytesPending++] = 32;
2330 span[BytesPending++] = token;
2331 }
2332
2333 [MethodImpl(MethodImplOptions.AggressiveInlining)]
2342
2348
2365
2371
2372 public void WriteNull(string propertyName)
2373 {
2374 WriteNull((propertyName ?? throw new ArgumentNullException("propertyName")).AsSpan());
2375 }
2376
2385
2394
2396 {
2397 if (value)
2398 {
2401 }
2402 else
2403 {
2405 _tokenType = JsonTokenType.False;
2406 }
2407 }
2408
2409 public void WriteBoolean(string propertyName, bool value)
2410 {
2411 WriteBoolean((propertyName ?? throw new ArgumentNullException("propertyName")).AsSpan(), value);
2412 }
2413
2422
2431
2433 {
2435 if (num != -1)
2436 {
2438 }
2439 else
2440 {
2442 }
2443 }
2444
2457
2471
2485
2498
2511
2513 {
2514 int num = escapedPropertyName.Length * 3 + value.Length + 4;
2515 if (_memory.Length - BytesPending < num)
2516 {
2517 Grow(num);
2518 }
2520 if (_currentDepth < 0)
2521 {
2522 span[BytesPending++] = 44;
2523 }
2524 span[BytesPending++] = 34;
2526 span[BytesPending++] = 34;
2527 span[BytesPending++] = 58;
2528 value.CopyTo(span.Slice(BytesPending));
2529 BytesPending += value.Length;
2530 }
2531
2533 {
2535 int num2 = num + 1;
2537 {
2538 Grow(num2);
2539 }
2541 if (_currentDepth < 0)
2542 {
2543 span[BytesPending++] = 44;
2544 }
2545 span[BytesPending++] = 34;
2546 escapedPropertyName.CopyTo(span.Slice(BytesPending));
2548 span[BytesPending++] = 34;
2549 span[BytesPending++] = 58;
2550 value.CopyTo(span.Slice(BytesPending));
2551 BytesPending += value.Length;
2552 }
2553
2554 [MethodImpl(MethodImplOptions.AggressiveInlining)]
2556 {
2557 int num = escapedPropertyNameSection.Length + value.Length;
2558 int num2 = num + 1;
2560 {
2561 Grow(num2);
2562 }
2564 if (_currentDepth < 0)
2565 {
2566 span[BytesPending++] = 44;
2567 }
2570 value.CopyTo(span.Slice(BytesPending));
2571 BytesPending += value.Length;
2572 }
2573
2575 {
2578 if (_memory.Length - BytesPending < num)
2579 {
2580 Grow(num);
2581 }
2583 if (_currentDepth < 0)
2584 {
2585 span[BytesPending++] = 44;
2586 }
2587 if (_tokenType != 0)
2588 {
2590 }
2593 span[BytesPending++] = 34;
2595 span[BytesPending++] = 34;
2596 span[BytesPending++] = 58;
2597 span[BytesPending++] = 32;
2598 value.CopyTo(span.Slice(BytesPending));
2599 BytesPending += value.Length;
2600 }
2601
2603 {
2606 int num2 = num + 1 + s_newLineLength;
2608 {
2609 Grow(num2);
2610 }
2612 if (_currentDepth < 0)
2613 {
2614 span[BytesPending++] = 44;
2615 }
2616 if (_tokenType != 0)
2617 {
2619 }
2622 span[BytesPending++] = 34;
2623 escapedPropertyName.CopyTo(span.Slice(BytesPending));
2625 span[BytesPending++] = 34;
2626 span[BytesPending++] = 58;
2627 span[BytesPending++] = 32;
2628 value.CopyTo(span.Slice(BytesPending));
2629 BytesPending += value.Length;
2630 }
2631
2639
2647
2648 public void WriteNumber(string propertyName, long value)
2649 {
2650 WriteNumber((propertyName ?? throw new ArgumentNullException("propertyName")).AsSpan(), value);
2651 }
2652
2660
2668
2670 {
2672 }
2673
2674 public void WriteNumber(string propertyName, int value)
2675 {
2676 WriteNumber((propertyName ?? throw new ArgumentNullException("propertyName")).AsSpan(), (long)value);
2677 }
2678
2680 {
2682 }
2683
2688
2690 {
2692 if (num != -1)
2693 {
2695 }
2696 else
2697 {
2699 }
2700 }
2701
2703 {
2705 if (num != -1)
2706 {
2708 }
2709 else
2710 {
2712 }
2713 }
2714
2728
2742
2744 {
2746 if (_options.Indented)
2747 {
2749 }
2750 else
2751 {
2753 }
2754 }
2755
2768
2770 {
2771 int num = escapedPropertyName.Length * 3 + 20 + 4;
2772 if (_memory.Length - BytesPending < num)
2773 {
2774 Grow(num);
2775 }
2777 if (_currentDepth < 0)
2778 {
2779 span[BytesPending++] = 44;
2780 }
2781 span[BytesPending++] = 34;
2783 span[BytesPending++] = 34;
2784 span[BytesPending++] = 58;
2785 int bytesWritten;
2788 }
2789
2791 {
2792 int num = escapedPropertyName.Length + 20 + 3;
2793 int num2 = num + 1;
2795 {
2796 Grow(num2);
2797 }
2799 if (_currentDepth < 0)
2800 {
2801 span[BytesPending++] = 44;
2802 }
2803 span[BytesPending++] = 34;
2804 escapedPropertyName.CopyTo(span.Slice(BytesPending));
2806 span[BytesPending++] = 34;
2807 span[BytesPending++] = 58;
2808 int bytesWritten;
2811 }
2812
2814 {
2816 int num = indentation + escapedPropertyName.Length * 3 + 20 + 5 + s_newLineLength;
2817 if (_memory.Length - BytesPending < num)
2818 {
2819 Grow(num);
2820 }
2822 if (_currentDepth < 0)
2823 {
2824 span[BytesPending++] = 44;
2825 }
2826 if (_tokenType != 0)
2827 {
2829 }
2832 span[BytesPending++] = 34;
2834 span[BytesPending++] = 34;
2835 span[BytesPending++] = 58;
2836 span[BytesPending++] = 32;
2837 int bytesWritten;
2840 }
2841
2843 {
2845 int num = indentation + escapedPropertyName.Length + 20 + 4;
2846 int num2 = num + 1 + s_newLineLength;
2848 {
2849 Grow(num2);
2850 }
2852 if (_currentDepth < 0)
2853 {
2854 span[BytesPending++] = 44;
2855 }
2856 if (_tokenType != 0)
2857 {
2859 }
2862 span[BytesPending++] = 34;
2863 escapedPropertyName.CopyTo(span.Slice(BytesPending));
2865 span[BytesPending++] = 34;
2866 span[BytesPending++] = 58;
2867 span[BytesPending++] = 32;
2868 int bytesWritten;
2871 }
2872
2873 internal void WritePropertyName(int value)
2874 {
2875 WritePropertyName((long)value);
2876 }
2877
2878 internal void WritePropertyName(long value)
2879 {
2881 int bytesWritten;
2884 }
2885
2887 {
2888 WritePropertyNameHelper(propertyName.EncodedUtf8Bytes);
2889 }
2890
2905
2912
2914 {
2915 WritePropertyName((propertyName ?? throw new ArgumentNullException("propertyName")).AsSpan());
2916 }
2917
2919 {
2922 if (num != -1)
2923 {
2925 }
2926 else
2927 {
2929 }
2930 _currentDepth &= int.MaxValue;
2931 _tokenType = JsonTokenType.PropertyName;
2932 }
2933
2935 {
2936 char[] array = null;
2937 if (firstEscapeIndexProp != -1)
2938 {
2941 if (maxEscapedLength > 128)
2942 {
2945 }
2946 else
2947 {
2948 char* pointer = stackalloc char[128];
2949 destination = new Span<char>(pointer, 128);
2950 }
2952 propertyName = destination.Slice(0, written);
2953 }
2955 if (array != null)
2956 {
2958 }
2959 }
2960
2973
2975 {
2976 int num = escapedPropertyName.Length * 3 + 4;
2977 if (_memory.Length - BytesPending < num)
2978 {
2979 Grow(num);
2980 }
2982 if (_currentDepth < 0)
2983 {
2984 span[BytesPending++] = 44;
2985 }
2986 span[BytesPending++] = 34;
2988 span[BytesPending++] = 34;
2989 span[BytesPending++] = 58;
2990 }
2991
2993 {
2996 if (_memory.Length - BytesPending < num)
2997 {
2998 Grow(num);
2999 }
3001 if (_currentDepth < 0)
3002 {
3003 span[BytesPending++] = 44;
3004 }
3005 if (_tokenType != 0)
3006 {
3008 }
3011 span[BytesPending++] = 34;
3013 span[BytesPending++] = 34;
3014 span[BytesPending++] = 58;
3015 span[BytesPending++] = 32;
3016 }
3017
3033
3041
3068
3081
3082 [MethodImpl(MethodImplOptions.AggressiveInlining)]
3084 {
3085 int num = escapedPropertyName.Length + 3;
3086 int num2 = num + 1;
3088 {
3089 Grow(num2);
3090 }
3092 if (_currentDepth < 0)
3093 {
3094 span[BytesPending++] = 44;
3095 }
3096 span[BytesPending++] = 34;
3097 escapedPropertyName.CopyTo(span.Slice(BytesPending));
3099 span[BytesPending++] = 34;
3100 span[BytesPending++] = 58;
3101 }
3102
3103 [MethodImpl(MethodImplOptions.AggressiveInlining)]
3105 {
3107 if (_memory.Length - BytesPending < num)
3108 {
3109 Grow(num);
3110 }
3112 if (_currentDepth < 0)
3113 {
3114 span[BytesPending++] = 44;
3115 }
3118 }
3119
3120 [MethodImpl(MethodImplOptions.AggressiveInlining)]
3122 {
3125 int num2 = num + 1 + s_newLineLength;
3127 {
3128 Grow(num2);
3129 }
3131 if (_currentDepth < 0)
3132 {
3133 span[BytesPending++] = 44;
3134 }
3135 if (_tokenType != 0)
3136 {
3138 }
3141 span[BytesPending++] = 34;
3142 escapedPropertyName.CopyTo(span.Slice(BytesPending));
3144 span[BytesPending++] = 34;
3145 span[BytesPending++] = 58;
3146 span[BytesPending++] = 32;
3147 }
3148
3150 {
3151 WriteStringHelper(propertyName.EncodedUtf8Bytes, value.EncodedUtf8Bytes);
3152 }
3153
3160
3162 {
3163 WriteString((propertyName ?? throw new ArgumentNullException("propertyName")).AsSpan(), value);
3164 }
3165
3166 public void WriteString(string propertyName, string? value)
3167 {
3168 if (propertyName == null)
3169 {
3170 throw new ArgumentNullException("propertyName");
3171 }
3172 if (value == null)
3173 {
3174 WriteNull(propertyName.AsSpan());
3175 }
3176 else
3177 {
3178 WriteString(propertyName.AsSpan(), value.AsSpan());
3179 }
3180 }
3181
3189
3197
3199 {
3200 if (value == null)
3201 {
3203 }
3204 else
3205 {
3206 WriteString(propertyName, value.AsSpan());
3207 }
3208 }
3209
3214
3230
3232 {
3233 WriteString((propertyName ?? throw new ArgumentNullException("propertyName")).AsSpan(), value);
3234 }
3235
3243
3248
3264
3266 {
3267 WriteString((propertyName ?? throw new ArgumentNullException("propertyName")).AsSpan(), utf8Value);
3268 }
3269
3277
3282
3298
3300 {
3301 if (value == null)
3302 {
3304 }
3305 else
3306 {
3307 WriteString(propertyName, value.AsSpan());
3308 }
3309 }
3310
3315
3331
3333 {
3334 if (value == null)
3335 {
3337 }
3338 else
3339 {
3341 }
3342 }
3343
3357
3371
3385
3399
3413
3427
3441
3455
3457 {
3458 char[] array = null;
3459 char[] array2 = null;
3460 if (firstEscapeIndexVal != -1)
3461 {
3464 if (maxEscapedLength > 128)
3465 {
3468 }
3469 else
3470 {
3471 char* pointer = stackalloc char[128];
3472 destination = new Span<char>(pointer, 128);
3473 }
3475 value = destination.Slice(0, written);
3476 }
3477 if (firstEscapeIndexProp != -1)
3478 {
3481 if (maxEscapedLength2 > 128)
3482 {
3485 }
3486 else
3487 {
3488 char* pointer2 = stackalloc char[128];
3489 destination2 = new Span<char>(pointer2, 128);
3490 }
3493 }
3495 if (array != null)
3496 {
3498 }
3499 if (array2 != null)
3500 {
3502 }
3503 }
3504
3506 {
3507 byte[] array = null;
3508 byte[] array2 = null;
3509 if (firstEscapeIndexVal != -1)
3510 {
3513 if (maxEscapedLength > 256)
3514 {
3517 }
3518 else
3519 {
3520 byte* pointer = stackalloc byte[256];
3521 destination = new Span<byte>(pointer, 256);
3522 }
3524 utf8Value = destination.Slice(0, written);
3525 }
3526 if (firstEscapeIndexProp != -1)
3527 {
3530 if (maxEscapedLength2 > 256)
3531 {
3534 }
3535 else
3536 {
3537 byte* pointer2 = stackalloc byte[256];
3538 destination2 = new Span<byte>(pointer2, 256);
3539 }
3542 }
3544 if (array != null)
3545 {
3547 }
3548 if (array2 != null)
3549 {
3551 }
3552 }
3553
3555 {
3556 byte[] array = null;
3557 char[] array2 = null;
3558 if (firstEscapeIndexVal != -1)
3559 {
3562 if (maxEscapedLength > 256)
3563 {
3566 }
3567 else
3568 {
3569 byte* pointer = stackalloc byte[256];
3570 destination = new Span<byte>(pointer, 256);
3571 }
3573 utf8Value = destination.Slice(0, written);
3574 }
3575 if (firstEscapeIndexProp != -1)
3576 {
3579 if (maxEscapedLength2 > 128)
3580 {
3583 }
3584 else
3585 {
3586 char* pointer2 = stackalloc char[128];
3587 destination2 = new Span<char>(pointer2, 128);
3588 }
3591 }
3593 if (array != null)
3594 {
3596 }
3597 if (array2 != null)
3598 {
3600 }
3601 }
3602
3604 {
3605 char[] array = null;
3606 byte[] array2 = null;
3607 if (firstEscapeIndexVal != -1)
3608 {
3611 if (maxEscapedLength > 128)
3612 {
3615 }
3616 else
3617 {
3618 char* pointer = stackalloc char[128];
3619 destination = new Span<char>(pointer, 128);
3620 }
3622 value = destination.Slice(0, written);
3623 }
3624 if (firstEscapeIndexProp != -1)
3625 {
3628 if (maxEscapedLength2 > 256)
3629 {
3632 }
3633 else
3634 {
3635 byte* pointer2 = stackalloc byte[256];
3636 destination2 = new Span<byte>(pointer2, 256);
3637 }
3640 }
3642 if (array != null)
3643 {
3645 }
3646 if (array2 != null)
3647 {
3649 }
3650 }
3651
3664
3677
3690
3703
3705 {
3706 int num = (escapedPropertyName.Length + escapedValue.Length) * 3 + 6;
3707 if (_memory.Length - BytesPending < num)
3708 {
3709 Grow(num);
3710 }
3712 if (_currentDepth < 0)
3713 {
3714 span[BytesPending++] = 44;
3715 }
3716 span[BytesPending++] = 34;
3718 span[BytesPending++] = 34;
3719 span[BytesPending++] = 58;
3720 span[BytesPending++] = 34;
3722 span[BytesPending++] = 34;
3723 }
3724
3726 {
3728 int num2 = num + 1;
3730 {
3731 Grow(num2);
3732 }
3734 if (_currentDepth < 0)
3735 {
3736 span[BytesPending++] = 44;
3737 }
3738 span[BytesPending++] = 34;
3739 escapedPropertyName.CopyTo(span.Slice(BytesPending));
3741 span[BytesPending++] = 34;
3742 span[BytesPending++] = 58;
3743 span[BytesPending++] = 34;
3744 escapedValue.CopyTo(span.Slice(BytesPending));
3745 BytesPending += escapedValue.Length;
3746 span[BytesPending++] = 34;
3747 }
3748
3750 {
3752 if (_memory.Length - BytesPending < num)
3753 {
3754 Grow(num);
3755 }
3757 if (_currentDepth < 0)
3758 {
3759 span[BytesPending++] = 44;
3760 }
3761 span[BytesPending++] = 34;
3763 span[BytesPending++] = 34;
3764 span[BytesPending++] = 58;
3765 span[BytesPending++] = 34;
3766 escapedValue.CopyTo(span.Slice(BytesPending));
3767 BytesPending += escapedValue.Length;
3768 span[BytesPending++] = 34;
3769 }
3770
3772 {
3774 if (_memory.Length - BytesPending < num)
3775 {
3776 Grow(num);
3777 }
3779 if (_currentDepth < 0)
3780 {
3781 span[BytesPending++] = 44;
3782 }
3783 span[BytesPending++] = 34;
3784 escapedPropertyName.CopyTo(span.Slice(BytesPending));
3786 span[BytesPending++] = 34;
3787 span[BytesPending++] = 58;
3788 span[BytesPending++] = 34;
3790 span[BytesPending++] = 34;
3791 }
3792
3794 {
3796 int num = indentation + (escapedPropertyName.Length + escapedValue.Length) * 3 + 7 + s_newLineLength;
3797 if (_memory.Length - BytesPending < num)
3798 {
3799 Grow(num);
3800 }
3802 if (_currentDepth < 0)
3803 {
3804 span[BytesPending++] = 44;
3805 }
3806 if (_tokenType != 0)
3807 {
3809 }
3812 span[BytesPending++] = 34;
3814 span[BytesPending++] = 34;
3815 span[BytesPending++] = 58;
3816 span[BytesPending++] = 32;
3817 span[BytesPending++] = 34;
3819 span[BytesPending++] = 34;
3820 }
3821
3823 {
3826 int num2 = num + 1 + s_newLineLength;
3828 {
3829 Grow(num2);
3830 }
3832 if (_currentDepth < 0)
3833 {
3834 span[BytesPending++] = 44;
3835 }
3836 if (_tokenType != 0)
3837 {
3839 }
3842 span[BytesPending++] = 34;
3843 escapedPropertyName.CopyTo(span.Slice(BytesPending));
3845 span[BytesPending++] = 34;
3846 span[BytesPending++] = 58;
3847 span[BytesPending++] = 32;
3848 span[BytesPending++] = 34;
3849 escapedValue.CopyTo(span.Slice(BytesPending));
3850 BytesPending += escapedValue.Length;
3851 span[BytesPending++] = 34;
3852 }
3853
3855 {
3858 if (_memory.Length - BytesPending < num)
3859 {
3860 Grow(num);
3861 }
3863 if (_currentDepth < 0)
3864 {
3865 span[BytesPending++] = 44;
3866 }
3867 if (_tokenType != 0)
3868 {
3870 }
3873 span[BytesPending++] = 34;
3875 span[BytesPending++] = 34;
3876 span[BytesPending++] = 58;
3877 span[BytesPending++] = 32;
3878 span[BytesPending++] = 34;
3879 escapedValue.CopyTo(span.Slice(BytesPending));
3880 BytesPending += escapedValue.Length;
3881 span[BytesPending++] = 34;
3882 }
3883
3885 {
3888 if (_memory.Length - BytesPending < num)
3889 {
3890 Grow(num);
3891 }
3893 if (_currentDepth < 0)
3894 {
3895 span[BytesPending++] = 44;
3896 }
3897 if (_tokenType != 0)
3898 {
3900 }
3903 span[BytesPending++] = 34;
3904 escapedPropertyName.CopyTo(span.Slice(BytesPending));
3906 span[BytesPending++] = 34;
3907 span[BytesPending++] = 58;
3908 span[BytesPending++] = 32;
3909 span[BytesPending++] = 34;
3911 span[BytesPending++] = 34;
3912 }
3913
3914 [CLSCompliant(false)]
3922
3923 [CLSCompliant(false)]
3924 public void WriteNumber(string propertyName, ulong value)
3925 {
3926 WriteNumber((propertyName ?? throw new ArgumentNullException("propertyName")).AsSpan(), value);
3927 }
3928
3929 [CLSCompliant(false)]
3937
3938 [CLSCompliant(false)]
3946
3947 [CLSCompliant(false)]
3949 {
3951 }
3952
3953 [CLSCompliant(false)]
3954 public void WriteNumber(string propertyName, uint value)
3955 {
3956 WriteNumber((propertyName ?? throw new ArgumentNullException("propertyName")).AsSpan(), (ulong)value);
3957 }
3958
3959 [CLSCompliant(false)]
3961 {
3963 }
3964
3965 [CLSCompliant(false)]
3970
3972 {
3974 if (num != -1)
3975 {
3977 }
3978 else
3979 {
3981 }
3982 }
3983
3985 {
3987 if (num != -1)
3988 {
3990 }
3991 else
3992 {
3994 }
3995 }
3996
4010
4024
4026 {
4028 if (_options.Indented)
4029 {
4031 }
4032 else
4033 {
4035 }
4036 }
4037
4050
4052 {
4053 int num = escapedPropertyName.Length * 3 + 20 + 4;
4054 if (_memory.Length - BytesPending < num)
4055 {
4056 Grow(num);
4057 }
4059 if (_currentDepth < 0)
4060 {
4061 span[BytesPending++] = 44;
4062 }
4063 span[BytesPending++] = 34;
4065 span[BytesPending++] = 34;
4066 span[BytesPending++] = 58;
4067 int bytesWritten;
4070 }
4071
4073 {
4074 int num = escapedPropertyName.Length + 20 + 3;
4075 int num2 = num + 1;
4077 {
4078 Grow(num2);
4079 }
4081 if (_currentDepth < 0)
4082 {
4083 span[BytesPending++] = 44;
4084 }
4085 span[BytesPending++] = 34;
4086 escapedPropertyName.CopyTo(span.Slice(BytesPending));
4088 span[BytesPending++] = 34;
4089 span[BytesPending++] = 58;
4090 int bytesWritten;
4093 }
4094
4096 {
4098 int num = indentation + escapedPropertyName.Length * 3 + 20 + 5 + s_newLineLength;
4099 if (_memory.Length - BytesPending < num)
4100 {
4101 Grow(num);
4102 }
4104 if (_currentDepth < 0)
4105 {
4106 span[BytesPending++] = 44;
4107 }
4108 if (_tokenType != 0)
4109 {
4111 }
4114 span[BytesPending++] = 34;
4116 span[BytesPending++] = 34;
4117 span[BytesPending++] = 58;
4118 span[BytesPending++] = 32;
4119 int bytesWritten;
4122 }
4123
4125 {
4127 int num = indentation + escapedPropertyName.Length + 20 + 4;
4128 int num2 = num + 1 + s_newLineLength;
4130 {
4131 Grow(num2);
4132 }
4134 if (_currentDepth < 0)
4135 {
4136 span[BytesPending++] = 44;
4137 }
4138 if (_tokenType != 0)
4139 {
4141 }
4144 span[BytesPending++] = 34;
4145 escapedPropertyName.CopyTo(span.Slice(BytesPending));
4147 span[BytesPending++] = 34;
4148 span[BytesPending++] = 58;
4149 span[BytesPending++] = 32;
4150 int bytesWritten;
4153 }
4154
4155 internal void WritePropertyName(uint value)
4156 {
4157 WritePropertyName((ulong)value);
4158 }
4159
4160 internal void WritePropertyName(ulong value)
4161 {
4163 int bytesWritten;
4166 }
4167
4175
4177 {
4179 {
4181 }
4182 if (_options.Indented)
4183 {
4185 }
4186 else
4187 {
4189 }
4190 }
4191
4193 {
4195 int num = maxEncodedToUtf8Length + 3;
4196 if (_memory.Length - BytesPending < num)
4197 {
4198 Grow(num);
4199 }
4201 if (_currentDepth < 0)
4202 {
4203 span[BytesPending++] = 44;
4204 }
4205 span[BytesPending++] = 34;
4207 span[BytesPending++] = 34;
4208 }
4209
4211 {
4215 if (_memory.Length - BytesPending < num)
4216 {
4217 Grow(num);
4218 }
4220 if (_currentDepth < 0)
4221 {
4222 span[BytesPending++] = 44;
4223 }
4224 if (_tokenType != JsonTokenType.PropertyName)
4225 {
4226 if (_tokenType != 0)
4227 {
4229 }
4232 }
4233 span[BytesPending++] = 34;
4235 span[BytesPending++] = 34;
4236 }
4237
4238 public void WriteCommentValue(string value)
4239 {
4240 WriteCommentValue((value ?? throw new ArgumentNullException("value")).AsSpan());
4241 }
4242
4252
4254 {
4255 if (_options.Indented)
4256 {
4258 }
4259 else
4260 {
4262 }
4263 }
4264
4266 {
4267 int num = value.Length * 3 + 4;
4268 if (_memory.Length - BytesPending < num)
4269 {
4270 Grow(num);
4271 }
4273 span[BytesPending++] = 47;
4275 span[bytesConsumed] = 42;
4277 int bytesWritten;
4280 span[BytesPending++] = 42;
4281 span[BytesPending++] = 47;
4282 }
4283
4309
4319
4321 {
4322 if (_options.Indented)
4323 {
4325 }
4326 else
4327 {
4329 }
4330 }
4331
4333 {
4334 int num = utf8Value.Length + 4;
4335 if (_memory.Length - BytesPending < num)
4336 {
4337 Grow(num);
4338 }
4340 span[BytesPending++] = 47;
4341 span[BytesPending++] = 42;
4342 utf8Value.CopyTo(span.Slice(BytesPending));
4343 BytesPending += utf8Value.Length;
4344 span[BytesPending++] = 42;
4345 span[BytesPending++] = 47;
4346 }
4347
4349 {
4351 int num = indentation + utf8Value.Length + 4;
4352 int num2 = num + s_newLineLength;
4354 {
4355 Grow(num2);
4356 }
4358 if (_tokenType != JsonTokenType.PropertyName)
4359 {
4360 if (_tokenType != 0)
4361 {
4363 }
4366 }
4367 span[BytesPending++] = 47;
4368 span[BytesPending++] = 42;
4369 utf8Value.CopyTo(span.Slice(BytesPending));
4370 BytesPending += utf8Value.Length;
4371 span[BytesPending++] = 42;
4372 span[BytesPending++] = 47;
4373 }
4374
4376 {
4378 {
4380 }
4381 if (_options.Indented)
4382 {
4384 }
4385 else
4386 {
4388 }
4390 _tokenType = JsonTokenType.String;
4391 }
4392
4394 {
4395 int num = 36;
4396 if (_memory.Length - BytesPending < num)
4397 {
4398 Grow(num);
4399 }
4401 if (_currentDepth < 0)
4402 {
4403 span[BytesPending++] = 44;
4404 }
4405 span[BytesPending++] = 34;
4408 span[BytesPending++] = 34;
4409 }
4410
4412 {
4414 int num = indentation + 33 + 3 + s_newLineLength;
4415 if (_memory.Length - BytesPending < num)
4416 {
4417 Grow(num);
4418 }
4420 if (_currentDepth < 0)
4421 {
4422 span[BytesPending++] = 44;
4423 }
4424 if (_tokenType != JsonTokenType.PropertyName)
4425 {
4426 if (_tokenType != 0)
4427 {
4429 }
4432 }
4433 span[BytesPending++] = 34;
4436 span[BytesPending++] = 34;
4437 }
4438
4440 {
4442 {
4444 }
4445 if (_options.Indented)
4446 {
4448 }
4449 else
4450 {
4452 }
4454 _tokenType = JsonTokenType.String;
4455 }
4456
4458 {
4459 int num = 36;
4460 if (_memory.Length - BytesPending < num)
4461 {
4462 Grow(num);
4463 }
4465 if (_currentDepth < 0)
4466 {
4467 span[BytesPending++] = 44;
4468 }
4469 span[BytesPending++] = 34;
4472 span[BytesPending++] = 34;
4473 }
4474
4476 {
4478 int num = indentation + 33 + 3 + s_newLineLength;
4479 if (_memory.Length - BytesPending < num)
4480 {
4481 Grow(num);
4482 }
4484 if (_currentDepth < 0)
4485 {
4486 span[BytesPending++] = 44;
4487 }
4488 if (_tokenType != JsonTokenType.PropertyName)
4489 {
4490 if (_tokenType != 0)
4491 {
4493 }
4496 }
4497 span[BytesPending++] = 34;
4500 span[BytesPending++] = 34;
4501 }
4502
4503 public void WriteNumberValue(decimal value)
4504 {
4506 {
4508 }
4509 if (_options.Indented)
4510 {
4512 }
4513 else
4514 {
4516 }
4518 _tokenType = JsonTokenType.Number;
4519 }
4520
4521 private void WriteNumberValueMinimized(decimal value)
4522 {
4523 int num = 32;
4524 if (_memory.Length - BytesPending < num)
4525 {
4526 Grow(num);
4527 }
4529 if (_currentDepth < 0)
4530 {
4531 span[BytesPending++] = 44;
4532 }
4533 int bytesWritten;
4536 }
4537
4538 private void WriteNumberValueIndented(decimal value)
4539 {
4541 int num = indentation + 31 + 1 + s_newLineLength;
4542 if (_memory.Length - BytesPending < num)
4543 {
4544 Grow(num);
4545 }
4547 if (_currentDepth < 0)
4548 {
4549 span[BytesPending++] = 44;
4550 }
4551 if (_tokenType != JsonTokenType.PropertyName)
4552 {
4553 if (_tokenType != 0)
4554 {
4556 }
4559 }
4560 int bytesWritten;
4563 }
4564
4572
4573 public void WriteNumberValue(double value)
4574 {
4577 {
4579 }
4580 if (_options.Indented)
4581 {
4583 }
4584 else
4585 {
4587 }
4589 _tokenType = JsonTokenType.Number;
4590 }
4591
4593 {
4594 int num = 129;
4595 if (_memory.Length - BytesPending < num)
4596 {
4597 Grow(num);
4598 }
4600 if (_currentDepth < 0)
4601 {
4602 span[BytesPending++] = 44;
4603 }
4604 int bytesWritten;
4605 bool flag = TryFormatDouble(value, span.Slice(BytesPending), out bytesWritten);
4607 }
4608
4609 private void WriteNumberValueIndented(double value)
4610 {
4612 int num = indentation + 128 + 1 + s_newLineLength;
4613 if (_memory.Length - BytesPending < num)
4614 {
4615 Grow(num);
4616 }
4618 if (_currentDepth < 0)
4619 {
4620 span[BytesPending++] = 44;
4621 }
4622 if (_tokenType != JsonTokenType.PropertyName)
4623 {
4624 if (_tokenType != 0)
4625 {
4627 }
4630 }
4631 int bytesWritten;
4632 bool flag = TryFormatDouble(value, span.Slice(BytesPending), out bytesWritten);
4634 }
4635
4637 {
4639 }
4640
4648
4649 internal void WriteFloatingPointConstant(double value)
4650 {
4651 if (double.IsNaN(value))
4652 {
4654 }
4655 else if (double.IsPositiveInfinity(value))
4656 {
4658 }
4659 else if (double.IsNegativeInfinity(value))
4660 {
4662 }
4663 else
4664 {
4666 }
4667 }
4668
4669 public void WriteNumberValue(float value)
4670 {
4673 {
4675 }
4676 if (_options.Indented)
4677 {
4679 }
4680 else
4681 {
4683 }
4685 _tokenType = JsonTokenType.Number;
4686 }
4687
4689 {
4690 int num = 129;
4691 if (_memory.Length - BytesPending < num)
4692 {
4693 Grow(num);
4694 }
4696 if (_currentDepth < 0)
4697 {
4698 span[BytesPending++] = 44;
4699 }
4700 int bytesWritten;
4701 bool flag = TryFormatSingle(value, span.Slice(BytesPending), out bytesWritten);
4703 }
4704
4706 {
4708 int num = indentation + 128 + 1 + s_newLineLength;
4709 if (_memory.Length - BytesPending < num)
4710 {
4711 Grow(num);
4712 }
4714 if (_currentDepth < 0)
4715 {
4716 span[BytesPending++] = 44;
4717 }
4718 if (_tokenType != JsonTokenType.PropertyName)
4719 {
4720 if (_tokenType != 0)
4721 {
4723 }
4726 }
4727 int bytesWritten;
4728 bool flag = TryFormatSingle(value, span.Slice(BytesPending), out bytesWritten);
4730 }
4731
4733 {
4735 }
4736
4744
4746 {
4747 if (float.IsNaN(value))
4748 {
4750 }
4751 else if (float.IsPositiveInfinity(value))
4752 {
4754 }
4755 else if (float.IsNegativeInfinity(value))
4756 {
4758 }
4759 else
4760 {
4762 }
4763 }
4764
4784
4786 {
4787 int num = utf8Value.Length + 1;
4788 if (_memory.Length - BytesPending < num)
4789 {
4790 Grow(num);
4791 }
4793 if (_currentDepth < 0)
4794 {
4795 span[BytesPending++] = 44;
4796 }
4797 utf8Value.CopyTo(span.Slice(BytesPending));
4798 BytesPending += utf8Value.Length;
4799 }
4800
4802 {
4805 if (_memory.Length - BytesPending < num)
4806 {
4807 Grow(num);
4808 }
4810 if (_currentDepth < 0)
4811 {
4812 span[BytesPending++] = 44;
4813 }
4814 if (_tokenType != JsonTokenType.PropertyName)
4815 {
4816 if (_tokenType != 0)
4817 {
4819 }
4822 }
4823 utf8Value.CopyTo(span.Slice(BytesPending));
4824 BytesPending += utf8Value.Length;
4825 }
4826
4828 {
4830 {
4832 }
4833 if (_options.Indented)
4834 {
4836 }
4837 else
4838 {
4840 }
4842 _tokenType = JsonTokenType.String;
4843 }
4844
4846 {
4847 int num = 39;
4848 if (_memory.Length - BytesPending < num)
4849 {
4850 Grow(num);
4851 }
4853 if (_currentDepth < 0)
4854 {
4855 span[BytesPending++] = 44;
4856 }
4857 span[BytesPending++] = 34;
4858 int bytesWritten;
4861 span[BytesPending++] = 34;
4862 }
4863
4865 {
4867 int num = indentation + 36 + 3 + s_newLineLength;
4868 if (_memory.Length - BytesPending < num)
4869 {
4870 Grow(num);
4871 }
4873 if (_currentDepth < 0)
4874 {
4875 span[BytesPending++] = 44;
4876 }
4877 if (_tokenType != JsonTokenType.PropertyName)
4878 {
4879 if (_tokenType != 0)
4880 {
4882 }
4885 }
4886 span[BytesPending++] = 34;
4887 int bytesWritten;
4890 span[BytesPending++] = 34;
4891 }
4892
4894 {
4895 if (_inObject)
4896 {
4897 if (_tokenType != JsonTokenType.PropertyName)
4898 {
4899 ThrowHelper.ThrowInvalidOperationException(ExceptionResource.CannotWriteValueWithinObject, 0, 0, _tokenType);
4900 }
4901 }
4902 else if (CurrentDepth == 0 && _tokenType != 0)
4903 {
4904 ThrowHelper.ThrowInvalidOperationException(ExceptionResource.CannotWriteValueAfterPrimitiveOrClose, 0, 0, _tokenType);
4905 }
4906 }
4907
4908 [MethodImpl(MethodImplOptions.AggressiveInlining)]
4926
4933
4934 public void WriteBooleanValue(bool value)
4935 {
4936 if (value)
4937 {
4940 }
4941 else
4942 {
4944 _tokenType = JsonTokenType.False;
4945 }
4947 }
4948
4950 {
4952 {
4954 }
4955 if (_options.Indented)
4956 {
4958 }
4959 else
4960 {
4962 }
4963 }
4964
4966 {
4967 int num = utf8Value.Length + 1;
4968 if (_memory.Length - BytesPending < num)
4969 {
4970 Grow(num);
4971 }
4973 if (_currentDepth < 0)
4974 {
4975 span[BytesPending++] = 44;
4976 }
4977 utf8Value.CopyTo(span.Slice(BytesPending));
4978 BytesPending += utf8Value.Length;
4979 }
4980
4982 {
4985 if (_memory.Length - BytesPending < num)
4986 {
4987 Grow(num);
4988 }
4990 if (_currentDepth < 0)
4991 {
4992 span[BytesPending++] = 44;
4993 }
4994 if (_tokenType != JsonTokenType.PropertyName)
4995 {
4996 if (_tokenType != 0)
4997 {
4999 }
5002 }
5003 utf8Value.CopyTo(span.Slice(BytesPending));
5004 BytesPending += utf8Value.Length;
5005 }
5006
5007 public void WriteRawValue(string json, bool skipInputValidation = false)
5008 {
5010 {
5012 }
5013 if (json == null)
5014 {
5015 throw new ArgumentNullException("json");
5016 }
5018 }
5019
5028
5030 {
5032 {
5034 }
5035 if (utf8Json.Length == int.MaxValue)
5036 {
5038 }
5040 }
5041
5043 {
5044 if (json.Length > 715827882)
5045 {
5047 }
5048 byte[] array = null;
5049 Span<byte> span = (((long)json.Length > 349525L) ? new byte[JsonReaderHelper.GetUtf8ByteCount(json)] : (array = ArrayPool<byte>.Shared.Rent(json.Length * 3)));
5050 try
5051 {
5054 }
5055 finally
5056 {
5057 if (array != null)
5058 {
5059 span.Clear();
5061 }
5062 }
5063 }
5064
5066 {
5067 int length = utf8Json.Length;
5068 if (length == 0)
5069 {
5071 }
5073 {
5074 _tokenType = JsonTokenType.String;
5075 }
5076 else
5077 {
5079 while (utf8JsonReader.Read())
5080 {
5081 }
5082 _tokenType = utf8JsonReader.TokenType;
5083 }
5084 int num = length + 1;
5085 if (_memory.Length - BytesPending < num)
5086 {
5087 Grow(num);
5088 }
5090 if (_currentDepth < 0)
5091 {
5092 span[BytesPending++] = 44;
5093 }
5094 utf8Json.CopyTo(span.Slice(BytesPending));
5097 }
5098
5099 public void WriteNumberValue(int value)
5100 {
5101 WriteNumberValue((long)value);
5102 }
5103
5104 public void WriteNumberValue(long value)
5105 {
5107 {
5109 }
5110 if (_options.Indented)
5111 {
5113 }
5114 else
5115 {
5117 }
5119 _tokenType = JsonTokenType.Number;
5120 }
5121
5123 {
5124 int num = 21;
5125 if (_memory.Length - BytesPending < num)
5126 {
5127 Grow(num);
5128 }
5130 if (_currentDepth < 0)
5131 {
5132 span[BytesPending++] = 44;
5133 }
5134 int bytesWritten;
5137 }
5138
5140 {
5142 int num = indentation + 20 + 1 + s_newLineLength;
5143 if (_memory.Length - BytesPending < num)
5144 {
5145 Grow(num);
5146 }
5148 if (_currentDepth < 0)
5149 {
5150 span[BytesPending++] = 44;
5151 }
5152 if (_tokenType != JsonTokenType.PropertyName)
5153 {
5154 if (_tokenType != 0)
5155 {
5157 }
5160 }
5161 int bytesWritten;
5164 }
5165
5173
5181
5182 public void WriteStringValue(string? value)
5183 {
5184 if (value == null)
5185 {
5187 }
5188 else
5189 {
5190 WriteStringValue(value.AsSpan());
5191 }
5192 }
5193
5201
5203 {
5205 if (num != -1)
5206 {
5208 }
5209 else
5210 {
5212 }
5213 }
5214
5216 {
5218 {
5220 }
5221 if (_options.Indented)
5222 {
5224 }
5225 else
5226 {
5228 }
5229 }
5230
5232 {
5233 int num = escapedValue.Length * 3 + 3;
5234 if (_memory.Length - BytesPending < num)
5235 {
5236 Grow(num);
5237 }
5239 if (_currentDepth < 0)
5240 {
5241 span[BytesPending++] = 44;
5242 }
5243 span[BytesPending++] = 34;
5245 span[BytesPending++] = 34;
5246 }
5247
5249 {
5251 int num = indentation + escapedValue.Length * 3 + 3 + s_newLineLength;
5252 if (_memory.Length - BytesPending < num)
5253 {
5254 Grow(num);
5255 }
5257 if (_currentDepth < 0)
5258 {
5259 span[BytesPending++] = 44;
5260 }
5261 if (_tokenType != JsonTokenType.PropertyName)
5262 {
5263 if (_tokenType != 0)
5264 {
5266 }
5269 }
5270 span[BytesPending++] = 34;
5272 span[BytesPending++] = 34;
5273 }
5274
5288
5296
5298 {
5300 if (num != -1)
5301 {
5303 }
5304 else
5305 {
5307 }
5308 }
5309
5311 {
5313 {
5315 }
5316 if (_options.Indented)
5317 {
5319 }
5320 else
5321 {
5323 }
5324 }
5325
5327 {
5328 int num = escapedValue.Length + 2;
5329 int num2 = num + 1;
5331 {
5332 Grow(num2);
5333 }
5335 if (_currentDepth < 0)
5336 {
5337 span[BytesPending++] = 44;
5338 }
5339 span[BytesPending++] = 34;
5340 escapedValue.CopyTo(span.Slice(BytesPending));
5341 BytesPending += escapedValue.Length;
5342 span[BytesPending++] = 34;
5343 }
5344
5346 {
5348 int num = indentation + escapedValue.Length + 2;
5349 int num2 = num + 1 + s_newLineLength;
5351 {
5352 Grow(num2);
5353 }
5355 if (_currentDepth < 0)
5356 {
5357 span[BytesPending++] = 44;
5358 }
5359 if (_tokenType != JsonTokenType.PropertyName)
5360 {
5361 if (_tokenType != 0)
5362 {
5364 }
5367 }
5368 span[BytesPending++] = 34;
5369 escapedValue.CopyTo(span.Slice(BytesPending));
5370 BytesPending += escapedValue.Length;
5371 span[BytesPending++] = 34;
5372 }
5373
5387
5394
5395 [CLSCompliant(false)]
5396 public void WriteNumberValue(uint value)
5397 {
5398 WriteNumberValue((ulong)value);
5399 }
5400
5401 [CLSCompliant(false)]
5402 public void WriteNumberValue(ulong value)
5403 {
5405 {
5407 }
5408 if (_options.Indented)
5409 {
5411 }
5412 else
5413 {
5415 }
5417 _tokenType = JsonTokenType.Number;
5418 }
5419
5421 {
5422 int num = 21;
5423 if (_memory.Length - BytesPending < num)
5424 {
5425 Grow(num);
5426 }
5428 if (_currentDepth < 0)
5429 {
5430 span[BytesPending++] = 44;
5431 }
5432 int bytesWritten;
5435 }
5436
5438 {
5440 int num = indentation + 20 + 1 + s_newLineLength;
5441 if (_memory.Length - BytesPending < num)
5442 {
5443 Grow(num);
5444 }
5446 if (_currentDepth < 0)
5447 {
5448 span[BytesPending++] = 44;
5449 }
5450 if (_tokenType != JsonTokenType.PropertyName)
5451 {
5452 if (_tokenType != 0)
5453 {
5455 }
5458 }
5459 int bytesWritten;
5462 }
5463
5471}
Memory< T > GetMemory(int sizeHint=0)
static ArrayPool< T > Shared
Definition ArrayPool.cs:7
static unsafe OperationStatus EncodeToUtf8(ReadOnlySpan< byte > bytes, Span< byte > utf8, out int bytesConsumed, out int bytesWritten, bool isFinalBlock=true)
Definition Base64.cs:413
static int GetMaxEncodedToUtf8Length(int length)
Definition Base64.cs:502
static bool TryFormat(bool value, Span< byte > destination, out int bytesWritten, StandardFormat format=default(StandardFormat))
static string NewLine
Task FlushAsync()
Definition Stream.cs:669
Task WriteAsync(byte[] buffer, int offset, int count)
Definition Stream.cs:914
void Write(byte[] buffer, int offset, int count)
static byte Max(byte val1, byte val2)
Definition Math.cs:738
static string ExpectedJsonTokens
Definition SR.cs:54
static string StreamNotWritable
Definition SR.cs:154
Definition SR.cs:7
static ReadOnlySpan< byte > NullValue
static ReadOnlySpan< byte > TrueValue
static ReadOnlySpan< byte > PositiveInfinityValue
static ReadOnlySpan< byte > FalseValue
static ReadOnlySpan< byte > NaNValue
static ReadOnlySpan< byte > NegativeInfinityValue
static void ValidateInt32MaxArrayLength(uint length)
static int GetUtf8FromText(ReadOnlySpan< char > text, Span< byte > dest)
static int GetUtf8ByteCount(ReadOnlySpan< char > text)
static void WriteIndentation(Span< byte > buffer, int indent)
static void WriteDateTimeTrimmed(Span< byte > buffer, DateTime value, out int bytesWritten)
static void ValidateBytes(ReadOnlySpan< byte > bytes)
static void ValidateNumber(ReadOnlySpan< byte > utf8FormattedNumber)
static bool NeedsEscaping(byte value)
static void ValidateSingle(float value)
static void ValidatePropertyAndValue(ReadOnlySpan< char > propertyName, ReadOnlySpan< byte > value)
static void WriteDateTimeOffsetTrimmed(Span< byte > buffer, DateTimeOffset value, out int bytesWritten)
static void ValidateValue(ReadOnlySpan< byte > value)
static void EscapeString(ReadOnlySpan< byte > value, Span< byte > destination, JavaScriptEncoder encoder, ref int written)
static void ValidateProperty(ReadOnlySpan< byte > propertyName)
static int GetMaxEscapedLength(int textLength, int firstIndexToEscape)
static unsafe OperationStatus ToUtf8(ReadOnlySpan< byte > utf16Source, Span< byte > utf8Destination, out int bytesConsumed, out int bytesWritten)
static void ValidateDouble(double value)
static void ValidatePropertyAndBytes(ReadOnlySpan< char > propertyName, ReadOnlySpan< byte > bytes)
static void ThrowArgumentException(string message)
static void ThrowInvalidOperationOrArgumentException(ReadOnlySpan< byte > propertyName, int currentDepth)
static void ThrowArgumentException_InvalidCommentValue()
static void ThrowInvalidOperationException(int currentDepth)
static void ThrowInvalidOperationException_NeedLargerSpan()
static void ThrowArgumentException_ValueTooLarge(int tokenLength)
void WritePropertyNameUnescaped(ReadOnlySpan< byte > utf8PropertyName)
void WriteString(ReadOnlySpan< byte > utf8PropertyName, DateTimeOffset value)
Utf8JsonWriter(Stream utf8Json, JsonWriterOptions options=default(JsonWriterOptions))
static readonly int s_newLineLength
void WriteNumber(JsonEncodedText propertyName, double value)
void WriteBase64String(JsonEncodedText propertyName, ReadOnlySpan< byte > bytes)
void WritePropertyNameIndented(ReadOnlySpan< byte > escapedPropertyName, byte token)
void WriteNumberValueMinimized(long value)
void WriteNumberIndented(ReadOnlySpan< char > escapedPropertyName, ulong value)
void WriteNumberByOptions(ReadOnlySpan< char > propertyName, long value)
void WriteBase64Minimized(ReadOnlySpan< byte > bytes)
void WriteLiteralMinimized(ReadOnlySpan< byte > escapedPropertyName, ReadOnlySpan< byte > value)
void WriteStringEscape(ReadOnlySpan< byte > utf8PropertyName, DateTime value)
void WriteStringByOptionsPropertyName(ReadOnlySpan< char > propertyName)
void WriteLiteralMinimized(ReadOnlySpan< char > escapedPropertyName, ReadOnlySpan< byte > value)
void WriteBase64Escape(ReadOnlySpan< char > propertyName, ReadOnlySpan< byte > bytes)
void WriteStringEscapePropertyOnly(ReadOnlySpan< char > propertyName, ReadOnlySpan< byte > escapedValue, int firstEscapeIndex)
IBufferWriter< byte > _output
void WriteStringEscape(ReadOnlySpan< char > propertyName, ReadOnlySpan< byte > utf8Value)
void WriteBase64Minimized(ReadOnlySpan< byte > escapedPropertyName, ReadOnlySpan< byte > bytes)
void WriteCommentValue(ReadOnlySpan< byte > utf8Value)
void WriteStringEscape(ReadOnlySpan< byte > utf8Value)
void WriteBase64Indented(ReadOnlySpan< byte > bytes)
void WriteNumberMinimized(ReadOnlySpan< byte > escapedPropertyName, ulong value)
void WriteNumberMinimized(ReadOnlySpan< char > escapedPropertyName, double value)
void WriteNumberEscape(ReadOnlySpan< char > propertyName, ulong value)
void WriteStringEscapeProperty(ReadOnlySpan< char > propertyName, DateTime value, int firstEscapeIndexProp)
void WriteStringEscapeProperty(ReadOnlySpan< byte > utf8PropertyName, DateTime value, int firstEscapeIndexProp)
void Grow(int requiredSize)
void WriteStringEscape(ReadOnlySpan< char > propertyName, DateTimeOffset value)
void WriteStringIndented(ReadOnlySpan< char > escapedPropertyName, ReadOnlySpan< char > escapedValue)
void WriteStartArray(ReadOnlySpan< byte > utf8PropertyName)
void WriteStringIndented(ReadOnlySpan< char > escapedPropertyName, DateTimeOffset value)
void WritePropertyNameMinimized(ReadOnlySpan< char > escapedPropertyName, byte token)
void WriteNumberMinimized(ReadOnlySpan< byte > escapedPropertyName, long value)
void WriteStringEscapeProperty(ReadOnlySpan< char > propertyName, DateTimeOffset value, int firstEscapeIndexProp)
void WriteStartObject(ReadOnlySpan< char > propertyName)
void WriteRawValue(string json, bool skipInputValidation=false)
void WriteStringByOptions(ReadOnlySpan< byte > utf8PropertyName, DateTimeOffset value)
void WriteNumber(ReadOnlySpan< char > propertyName, uint value)
void WriteLiteralByOptions(ReadOnlySpan< byte > utf8PropertyName, ReadOnlySpan< byte > value)
void WriteStringEscape(ReadOnlySpan< char > value)
void WriteNumber(ReadOnlySpan< byte > utf8PropertyName, int value)
void WriteStringMinimized(ReadOnlySpan< char > escapedPropertyName, Guid value)
void WriteNumber(ReadOnlySpan< char > propertyName, int value)
void WriteStringMinimized(ReadOnlySpan< char > escapedPropertyName, DateTime value)
void WriteRawValue(ReadOnlySpan< byte > utf8Json, bool skipInputValidation=false)
void WriteNumberByOptions(ReadOnlySpan< char > propertyName, decimal value)
static bool TryFormatSingle(float value, Span< byte > destination, out int bytesWritten)
void WriteNumberEscapeProperty(ReadOnlySpan< char > propertyName, ulong value, int firstEscapeIndexProp)
void WriteStringIndented(ReadOnlySpan< byte > escapedValue)
void WriteStringHelperEscapeProperty(ReadOnlySpan< char > propertyName, ReadOnlySpan< byte > utf8Value)
void WriteNumber(ReadOnlySpan< char > propertyName, decimal value)
void WriteNumberByOptions(ReadOnlySpan< byte > utf8PropertyName, ulong value)
void WriteStartArray(JsonEncodedText propertyName)
void WriteStartObject(JsonEncodedText propertyName)
void WriteNumberIndented(ReadOnlySpan< byte > escapedPropertyName, long value)
void WriteLiteralMinimized(ReadOnlySpan< byte > utf8Value)
void WriteNumberEscape(ReadOnlySpan< char > propertyName, double value)
void WriteStringByOptions(ReadOnlySpan< char > value)
void WriteStringByOptions(ReadOnlySpan< char > propertyName, ReadOnlySpan< byte > utf8Value)
void WriteNumberEscapeProperty(ReadOnlySpan< char > propertyName, float value, int firstEscapeIndexProp)
async Task FlushAsync(CancellationToken cancellationToken=default(CancellationToken))
void WritePropertyNameMinimized(ReadOnlySpan< byte > escapedPropertyName, byte token)
unsafe void WriteStringEscapePropertyOrValue(ReadOnlySpan< byte > utf8PropertyName, ReadOnlySpan< char > value, int firstEscapeIndexProp, int firstEscapeIndexVal)
void WriteStringByOptionsPropertyName(ReadOnlySpan< byte > utf8PropertyName)
void WriteNumber(ReadOnlySpan< byte > utf8PropertyName, long value)
void Reset(Stream utf8Json)
void WriteString(JsonEncodedText propertyName, string? value)
void WriteStartEscapeProperty(ReadOnlySpan< char > propertyName, byte token, int firstEscapeIndexProp)
void WriteStringMinimized(ReadOnlySpan< char > escapedPropertyName, ReadOnlySpan< byte > escapedValue)
void WriteStringByOptions(ReadOnlySpan< char > propertyName, DateTime value)
void WriteString(JsonEncodedText propertyName, DateTime value)
void WriteStartHelper(ReadOnlySpan< byte > utf8PropertyName, byte token)
void WriteString(string propertyName, ReadOnlySpan< byte > utf8Value)
void WriteNumberEscape(ReadOnlySpan< byte > utf8PropertyName, decimal value)
void WriteNumber(JsonEncodedText propertyName, ulong value)
void WriteNumber(JsonEncodedText propertyName, long value)
void WriteStringValue(DateTimeOffset value)
void WriteNumberEscape(ReadOnlySpan< byte > utf8PropertyName, float value)
void WriteNumberByOptions(ReadOnlySpan< byte > utf8PropertyName, decimal value)
unsafe void WriteStringEscapeProperty(ReadOnlySpan< char > propertyName, int firstEscapeIndexProp)
void WriteStringHelperEscapeValue(ReadOnlySpan< byte > utf8PropertyName, ReadOnlySpan< byte > utf8Value)
void WriteString(ReadOnlySpan< char > propertyName, ReadOnlySpan< char > value)
void WriteStringIndented(ReadOnlySpan< byte > escapedPropertyName, ReadOnlySpan< char > escapedValue)
void WriteFloatingPointConstant(float value)
void WritePropertyName(decimal value)
void WriteNumber(string propertyName, uint value)
void WriteNumberValueAsString(float value)
void WriteBase64ByOptions(ReadOnlySpan< byte > bytes)
void WriteString(ReadOnlySpan< byte > utf8PropertyName, string? value)
void WriteNumberIndented(ReadOnlySpan< char > escapedPropertyName, double value)
void WriteNumberEscape(ReadOnlySpan< char > propertyName, float value)
void WriteNumberMinimized(ReadOnlySpan< byte > escapedPropertyName, float value)
void WriteNumber(ReadOnlySpan< byte > utf8PropertyName, ulong value)
void WritePropertyName(DateTime value)
void WriteCommentMinimized(ReadOnlySpan< char > value)
void WriteStringMinimized(ReadOnlySpan< byte > escapedPropertyName, DateTime value)
void WriteNumberValueAsString(double value)
void WriteNumberIndented(ReadOnlySpan< char > escapedPropertyName, float value)
void WriteString(ReadOnlySpan< byte > utf8PropertyName, DateTime value)
void WriteStringEscapeProperty(ReadOnlySpan< char > propertyName, Guid value, int firstEscapeIndexProp)
void WritePropertyName(JsonEncodedText propertyName)
void FirstCallToGetMemory(int requiredSize)
void WriteString(ReadOnlySpan< char > propertyName, DateTime value)
void WriteString(string propertyName, Guid value)
unsafe void WriteStringEscapePropertyOrValue(ReadOnlySpan< char > propertyName, ReadOnlySpan< byte > utf8Value, int firstEscapeIndexProp, int firstEscapeIndexVal)
void WriteLiteralHelper(ReadOnlySpan< byte > utf8PropertyName, ReadOnlySpan< byte > value)
void WriteBase64String(ReadOnlySpan< char > propertyName, ReadOnlySpan< byte > bytes)
void WriteString(ReadOnlySpan< byte > utf8PropertyName, ReadOnlySpan< byte > utf8Value)
void WriteNumberValueMinimized(decimal value)
void WriteStringValueMinimized(DateTime value)
void WriteCommentIndented(ReadOnlySpan< byte > utf8Value)
void WriteNumberValueIndented(ulong value)
void WriteNumber(ReadOnlySpan< char > propertyName, float value)
void WriteStringIndented(ReadOnlySpan< byte > escapedPropertyName, DateTimeOffset value)
void WriteBase64EscapeProperty(ReadOnlySpan< char > propertyName, ReadOnlySpan< byte > bytes, int firstEscapeIndexProp)
void WriteStringIndentedPropertyName(ReadOnlySpan< byte > escapedPropertyName)
void WriteNumber(string propertyName, long value)
void WriteStringEscapePropertyOnly(ReadOnlySpan< byte > utf8PropertyName, ReadOnlySpan< byte > escapedValue, int firstEscapeIndex)
void WriteStringByOptions(ReadOnlySpan< char > propertyName, Guid value)
unsafe void WriteStringEscapeProperty(ReadOnlySpan< byte > utf8PropertyName, int firstEscapeIndexProp)
void WriteNumberMinimized(ReadOnlySpan< byte > escapedPropertyName, decimal value)
void WriteStringEscapeValueOnly(ReadOnlySpan< byte > escapedPropertyName, ReadOnlySpan< byte > utf8Value, int firstEscapeIndex)
void WriteBase64Minimized(ReadOnlySpan< char > escapedPropertyName, ReadOnlySpan< byte > bytes)
void WriteCommentByOptions(ReadOnlySpan< byte > utf8Value)
void WriteStringEscape(ReadOnlySpan< byte > utf8PropertyName, Guid value)
void WriteStartArray(string propertyName)
void WriteNumberValue(ReadOnlySpan< byte > utf8FormattedNumber)
void WriteString(ReadOnlySpan< byte > utf8PropertyName, ReadOnlySpan< char > value)
void WriteStartObject(ReadOnlySpan< byte > utf8PropertyName)
void WriteNull(string propertyName)
void WriteStringValue(JsonEncodedText value)
void WriteString(JsonEncodedText propertyName, ReadOnlySpan< byte > utf8Value)
void WriteNumberEscape(ReadOnlySpan< char > propertyName, decimal value)
void WriteBase64Indented(ReadOnlySpan< char > escapedPropertyName, ReadOnlySpan< byte > bytes)
void WriteString(string propertyName, string? value)
void WriteCommentIndented(ReadOnlySpan< char > value)
void WriteNumberValueAsString(decimal value)
void WriteNumberEscapeProperty(ReadOnlySpan< byte > utf8PropertyName, ulong value, int firstEscapeIndexProp)
void WriteString(JsonEncodedText propertyName, ReadOnlySpan< char > value)
void WriteNumberEscapeProperty(ReadOnlySpan< byte > utf8PropertyName, long value, int firstEscapeIndexProp)
void WritePropertyName(string propertyName)
void WriteNumber(ReadOnlySpan< char > propertyName, long value)
void WriteNumberEscapeProperty(ReadOnlySpan< char > propertyName, decimal value, int firstEscapeIndexProp)
void WriteNumberEscapeProperty(ReadOnlySpan< char > propertyName, long value, int firstEscapeIndexProp)
void WriteStartEscapeProperty(ReadOnlySpan< byte > utf8PropertyName, byte token, int firstEscapeIndexProp)
unsafe void WriteStringEscapePropertyOrValue(ReadOnlySpan< byte > utf8PropertyName, ReadOnlySpan< byte > utf8Value, int firstEscapeIndexProp, int firstEscapeIndexVal)
void WriteBase64StringValue(ReadOnlySpan< byte > bytes)
void WriteNumberIndented(ReadOnlySpan< byte > escapedPropertyName, decimal value)
void WriteStringValueIndented(DateTime value)
void WriteBase64Escape(ReadOnlySpan< byte > utf8PropertyName, ReadOnlySpan< byte > bytes)
void WriteStartByOptions(ReadOnlySpan< byte > utf8PropertyName, byte token)
void WriteNumberEscapeProperty(ReadOnlySpan< byte > utf8PropertyName, float value, int firstEscapeIndexProp)
void WriteStringEscapeProperty(ReadOnlySpan< byte > utf8PropertyName, Guid value, int firstEscapeIndexProp)
void WriteNumber(JsonEncodedText propertyName, decimal value)
void WriteLiteralEscape(ReadOnlySpan< byte > utf8PropertyName, ReadOnlySpan< byte > value)
void WriteNumber(string propertyName, double value)
void WriteBase64Indented(ReadOnlySpan< byte > escapedPropertyName, ReadOnlySpan< byte > bytes)
void WriteLiteralIndented(ReadOnlySpan< byte > utf8Value)
void WriteStringEscape(ReadOnlySpan< byte > utf8PropertyName, ReadOnlySpan< char > value)
void WriteLiteralByOptions(ReadOnlySpan< char > propertyName, ReadOnlySpan< byte > value)
void WriteStringMinimized(ReadOnlySpan< char > escapedPropertyName, ReadOnlySpan< char > escapedValue)
void WriteStringMinimized(ReadOnlySpan< byte > escapedPropertyName, DateTimeOffset value)
void WriteNumberEscape(ReadOnlySpan< char > propertyName, long value)
void WriteNumberValueIndented(long value)
void WriteString(JsonEncodedText propertyName, JsonEncodedText value)
void WriteFloatingPointConstant(double value)
void WriteNumber(JsonEncodedText propertyName, uint value)
void WriteStringMinimized(ReadOnlySpan< byte > escapedPropertyName, ReadOnlySpan< byte > escapedValue)
void WriteNumber(string propertyName, int value)
void WriteCommentValue(ReadOnlySpan< char > value)
void WriteStringEscape(ReadOnlySpan< char > propertyName, DateTime value)
void WriteNumberValueAsStringUnescaped(ReadOnlySpan< byte > utf8Value)
void WriteStartByOptions(ReadOnlySpan< char > propertyName, byte token)
void WriteNumber(ReadOnlySpan< byte > utf8PropertyName, uint value)
void WriteStringByOptions(ReadOnlySpan< char > propertyName, ReadOnlySpan< char > value)
void WriteNumber(string propertyName, decimal value)
void WriteNumberValueMinimized(ReadOnlySpan< byte > utf8Value)
void WriteBoolean(ReadOnlySpan< byte > utf8PropertyName, bool value)
void WriteNumberMinimized(ReadOnlySpan< char > escapedPropertyName, decimal value)
void WriteStringMinimized(ReadOnlySpan< byte > escapedValue)
void WriteNumberEscapeProperty(ReadOnlySpan< char > propertyName, double value, int firstEscapeIndexProp)
void WriteStringMinimized(ReadOnlySpan< char > escapedValue)
void WriteString(string propertyName, DateTime value)
void WriteNumberMinimized(ReadOnlySpan< char > escapedPropertyName, ulong value)
void Base64EncodeAndWrite(ReadOnlySpan< byte > bytes, Span< byte > output, int encodingLength)
void WriteBase64String(string propertyName, ReadOnlySpan< byte > bytes)
void WriteBase64EscapeProperty(ReadOnlySpan< byte > utf8PropertyName, ReadOnlySpan< byte > bytes, int firstEscapeIndexProp)
void WritePropertyNameHelper(ReadOnlySpan< byte > utf8PropertyName)
void WriteLiteralSection(ReadOnlySpan< byte > escapedPropertyNameSection, ReadOnlySpan< byte > value)
static ReadOnlySpan< byte > SingleLineCommentDelimiterUtf8
void WriteNumberEscapeProperty(ReadOnlySpan< byte > utf8PropertyName, double value, int firstEscapeIndexProp)
void WriteNumber(JsonEncodedText propertyName, int value)
ArrayBufferWriter< byte > _arrayBufferWriter
void WriteNumberValueIndented(decimal value)
void WriteStringMinimized(ReadOnlySpan< char > escapedPropertyName, DateTimeOffset value)
void WriteStringIndented(ReadOnlySpan< char > escapedPropertyName, Guid value)
void WriteNull(JsonEncodedText propertyName)
void WriteStringIndented(ReadOnlySpan< char > escapedPropertyName, ReadOnlySpan< byte > escapedValue)
void WriteStringHelper(ReadOnlySpan< byte > utf8PropertyName, ReadOnlySpan< byte > utf8Value)
void ValidatePropertyNameAndDepth(ReadOnlySpan< byte > utf8PropertyName)
void WriteNumberValueMinimized(ulong value)
void WriteNumberByOptions(ReadOnlySpan< byte > utf8PropertyName, double value)
void WriteNumberIndented(ReadOnlySpan< byte > escapedPropertyName, double value)
void WriteString(ReadOnlySpan< byte > utf8PropertyName, Guid value)
void WriteLiteralIndented(ReadOnlySpan< char > escapedPropertyName, ReadOnlySpan< byte > value)
void WriteNumberEscape(ReadOnlySpan< byte > utf8PropertyName, double value)
void WriteNumberMinimized(ReadOnlySpan< char > escapedPropertyName, long value)
void WritePropertyNameIndented(ReadOnlySpan< char > escapedPropertyName, byte token)
void WriteStringHelperEscapeProperty(ReadOnlySpan< byte > utf8PropertyName, ReadOnlySpan< byte > utf8Value)
void WritePropertyName(ReadOnlySpan< byte > utf8PropertyName)
void WriteString(JsonEncodedText propertyName, Guid value)
void WriteStringMinimizedPropertyName(ReadOnlySpan< char > escapedPropertyName)
void WriteNumber(ReadOnlySpan< byte > utf8PropertyName, decimal value)
void WriteNumberIndented(ReadOnlySpan< byte > escapedPropertyName, ulong value)
void WriteNumberValueIndented(ReadOnlySpan< byte > utf8Value)
void WriteRawValueCore(ReadOnlySpan< byte > utf8Json, bool skipInputValidation)
void WriteStringEscape(ReadOnlySpan< byte > utf8PropertyName, ReadOnlySpan< byte > utf8Value)
void WriteNewLine(Span< byte > output)
void WriteLiteralEscapeProperty(ReadOnlySpan< char > propertyName, ReadOnlySpan< byte > value, int firstEscapeIndexProp)
void WriteStringIndented(ReadOnlySpan< byte > escapedPropertyName, ReadOnlySpan< byte > escapedValue)
void WriteNumberValueAsString(ulong value)
void WriteString(ReadOnlySpan< char > propertyName, DateTimeOffset value)
void WriteNumber(ReadOnlySpan< char > propertyName, double value)
void WriteStringIndented(ReadOnlySpan< byte > escapedPropertyName, DateTime value)
void WriteNumberMinimized(ReadOnlySpan< char > escapedPropertyName, float value)
void WriteStringMinimized(ReadOnlySpan< byte > escapedPropertyName, Guid value)
void WriteStringValueMinimized(DateTimeOffset value)
void WriteStringMinimized(ReadOnlySpan< byte > escapedPropertyName, ReadOnlySpan< char > escapedValue)
void WriteNumber(ReadOnlySpan< byte > utf8PropertyName, double value)
Utf8JsonWriter(IBufferWriter< byte > bufferWriter, JsonWriterOptions options=default(JsonWriterOptions))
void WriteStringEscapeValue(ReadOnlySpan< byte > utf8Value, int firstEscapeIndexVal)
void WriteStringByOptions(ReadOnlySpan< byte > utf8Value)
void WriteNumberValueMinimized(double value)
void WriteNumberEscape(ReadOnlySpan< byte > utf8PropertyName, ulong value)
void WriteStringEscape(ReadOnlySpan< byte > utf8PropertyName, DateTimeOffset value)
void WriteString(ReadOnlySpan< char > propertyName, JsonEncodedText value)
void WriteStringValue(DateTime value)
void WriteRawValue(ReadOnlySpan< char > json, bool skipInputValidation=false)
void WriteNumberByOptions(ReadOnlySpan< byte > utf8PropertyName, long value)
void WriteString(string propertyName, JsonEncodedText value)
void WriteStartArray(ReadOnlySpan< char > propertyName)
void WriteLiteralIndented(ReadOnlySpan< byte > escapedPropertyName, ReadOnlySpan< byte > value)
void WriteNumber(ReadOnlySpan< byte > utf8PropertyName, float value)
void WriteStringEscape(ReadOnlySpan< char > propertyName, ReadOnlySpan< char > value)
void WriteBoolean(JsonEncodedText propertyName, bool value)
void WriteNumberIndented(ReadOnlySpan< char > escapedPropertyName, decimal value)
void ValidatePropertyNameAndDepth(ReadOnlySpan< char > propertyName)
void WriteStartEscape(ReadOnlySpan< byte > utf8PropertyName, byte token)
void WriteStringByOptions(ReadOnlySpan< char > propertyName, DateTimeOffset value)
void WritePropertyNameSection(ReadOnlySpan< byte > escapedPropertyNameSection)
void WriteNull(ReadOnlySpan< byte > utf8PropertyName)
void WriteNumberValueAsString(long value)
void WriteNumberIndented(ReadOnlySpan< char > escapedPropertyName, long value)
void WriteStringIndentedPropertyName(ReadOnlySpan< char > escapedPropertyName)
void WritePropertyName(DateTimeOffset value)
void WriteLiteralEscapeProperty(ReadOnlySpan< byte > utf8PropertyName, ReadOnlySpan< byte > value, int firstEscapeIndexProp)
void WriteNumber(ReadOnlySpan< char > propertyName, ulong value)
void WriteCommentByOptions(ReadOnlySpan< char > value)
void WriteStringByOptions(ReadOnlySpan< byte > utf8PropertyName, Guid value)
void WriteNumber(string propertyName, ulong value)
void WriteNumberByOptions(ReadOnlySpan< char > propertyName, ulong value)
unsafe void WriteStringEscapePropertyOrValue(ReadOnlySpan< char > propertyName, ReadOnlySpan< char > value, int firstEscapeIndexProp, int firstEscapeIndexVal)
void WriteString(string propertyName, DateTimeOffset value)
void WriteNumberByOptions(ReadOnlySpan< char > propertyName, float value)
void WriteStringValueMinimized(Guid value)
void WriteNumber(string propertyName, float value)
void WriteStringIndented(ReadOnlySpan< byte > escapedPropertyName, Guid value)
void TranscodeAndWrite(ReadOnlySpan< char > escapedPropertyName, Span< byte > output)
void WriteStringEscapeValue(ReadOnlySpan< char > value, int firstEscapeIndexVal)
void WritePropertyName(ReadOnlySpan< char > propertyName)
void WriteStringValueIndented(DateTimeOffset value)
void WriteStringEscapeValueOnly(ReadOnlySpan< byte > escapedPropertyName, ReadOnlySpan< char > value, int firstEscapeIndex)
void WriteLiteralEscape(ReadOnlySpan< char > propertyName, ReadOnlySpan< byte > value)
void WriteBase64ByOptions(ReadOnlySpan< byte > utf8PropertyName, ReadOnlySpan< byte > bytes)
void WriteStringEscapeProperty(ReadOnlySpan< byte > utf8PropertyName, DateTimeOffset value, int firstEscapeIndexProp)
void WriteString(ReadOnlySpan< char > propertyName, string? value)
void WriteBase64String(ReadOnlySpan< byte > utf8PropertyName, ReadOnlySpan< byte > bytes)
void WriteBoolean(string propertyName, bool value)
void WriteStringPropertyNameSection(ReadOnlySpan< byte > escapedPropertyNameSection)
void WriteNull(ReadOnlySpan< char > propertyName)
void WriteString(ReadOnlySpan< char > propertyName, Guid value)
void WriteNumberEscape(ReadOnlySpan< byte > utf8PropertyName, long value)
void WriteStringValue(ReadOnlySpan< char > value)
void WriteNullSection(ReadOnlySpan< byte > escapedPropertyNameSection)
void WriteString(ReadOnlySpan< char > propertyName, ReadOnlySpan< byte > utf8Value)
void WriteNumberEscapeProperty(ReadOnlySpan< byte > utf8PropertyName, decimal value, int firstEscapeIndexProp)
void WriteLiteralByOptions(ReadOnlySpan< byte > utf8Value)
void WriteString(ReadOnlySpan< byte > utf8PropertyName, JsonEncodedText value)
void WriteNumberValueIndented(float value)
void WriteStringMinimizedPropertyName(ReadOnlySpan< byte > escapedPropertyName)
void WriteNumberIndented(ReadOnlySpan< byte > escapedPropertyName, float value)
void WriteStringEscape(ReadOnlySpan< char > propertyName, Guid value)
void WriteStringByOptions(ReadOnlySpan< byte > utf8PropertyName, ReadOnlySpan< byte > utf8Value)
void WriteNumberValueMinimized(float value)
void WriteStringByOptions(ReadOnlySpan< byte > utf8PropertyName, ReadOnlySpan< char > value)
void WriteStringByOptions(ReadOnlySpan< byte > utf8PropertyName, DateTime value)
void WriteStringValueIndented(Guid value)
static bool TryFormatDouble(double value, Span< byte > destination, out int bytesWritten)
void WriteStartEscape(ReadOnlySpan< char > propertyName, byte token)
void WriteNumberByOptions(ReadOnlySpan< char > propertyName, double value)
void WriteStringIndented(ReadOnlySpan< char > escapedValue)
void WriteString(string propertyName, ReadOnlySpan< char > value)
void WriteStringValue(string? value)
void WriteStringIndented(ReadOnlySpan< char > escapedPropertyName, DateTime value)
void WriteBoolean(ReadOnlySpan< char > propertyName, bool value)
void WriteStringValue(ReadOnlySpan< byte > utf8Value)
void WriteBase64ByOptions(ReadOnlySpan< char > propertyName, ReadOnlySpan< byte > bytes)
void WriteNumberMinimized(ReadOnlySpan< byte > escapedPropertyName, double value)
void WriteStringHelperEscapeValue(ReadOnlySpan< byte > utf8PropertyName, ReadOnlySpan< char > value)
void WriteCommentMinimized(ReadOnlySpan< byte > utf8Value)
void WriteNumberValue(decimal value)
static readonly char[] s_singleLineCommentDelimiter
void WriteNumber(JsonEncodedText propertyName, float value)
void WriteString(JsonEncodedText propertyName, DateTimeOffset value)
void WriteNumberByOptions(ReadOnlySpan< byte > utf8PropertyName, float value)
void WriteStartObject(string propertyName)
void WriteNumberValueIndented(double value)
void TranscodeAndWriteRawValue(ReadOnlySpan< char > json, bool skipInputValidation)
void Reset(IBufferWriter< byte > bufferWriter)
new ConfiguredTaskAwaitable< TResult > ConfigureAwait(bool continueOnCapturedContext)
Definition Task.cs:226
Memory< T > GetMemory(int sizeHint=0)
TokenType
Definition TokenType.cs:4
unsafe Span< T > Span
Definition Memory.cs:28
ReadOnlySpan< T > Slice(int start)
Span< T > Slice(int start)
Definition Span.cs:271