Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ EscapeValue()

static byte[] System.Text.Json.JsonHelpers.EscapeValue ( ReadOnlySpan< byte > utf8Value,
int firstEscapeIndexVal,
JavaScriptEncoder encoder )
inlinestatic

Definition at line 433 of file JsonHelpers.cs.

434 {
435 byte[] array = null;
436 int maxEscapedLength = JsonWriterHelper.GetMaxEscapedLength(utf8Value.Length, firstEscapeIndexVal);
437 Span<byte> span = ((maxEscapedLength > 256) ? ((Span<byte>)(array = ArrayPool<byte>.Shared.Rent(maxEscapedLength))) : stackalloc byte[256]);
439 JsonWriterHelper.EscapeString(utf8Value, destination, firstEscapeIndexVal, encoder, out var written);
440 byte[] result = destination.Slice(0, written).ToArray();
441 if (array != null)
442 {
443 ArrayPool<byte>.Shared.Return(array);
444 }
445 return result;
446 }

References System.array, System.destination, System.Text.Json.Dictionary, System.Text.Json.JsonWriterHelper.EscapeString(), and System.Text.Json.JsonWriterHelper.GetMaxEscapedLength().

Referenced by System.Text.Json.JsonEncodedText.EncodeHelper().