Exemplo n.º 1
0
        public void WriteCommentValue(ReadOnlySpan <byte> utf8Text, bool suppressEscaping = false)
        {
            JsonWriterHelper.ValidateValue(ref utf8Text);

            if (!suppressEscaping)
            {
                WriteCommentSuppressFalse(ref utf8Text);
            }
            else
            {
                WriteCommentByOptions(ref utf8Text);
            }

            _currentDepth |= 1 << 31;
            _tokenType     = JsonTokenType.String;
        }
Exemplo n.º 2
0
        public void WriteComment(ReadOnlySpan <byte> utf8Text)
        {
            JsonWriterHelper.ValidateValue(ref utf8Text);

            if (JsonWriterHelper.IndexOfAnyEscape(utf8Text) != -1)
            {
                //TODO: Add escaping.
                utf8Text = JsonWriterHelper.EscapeStringValue(utf8Text);
            }

            if (_writerOptions.Formatted)
            {
                WriteCommentFormatted(ref utf8Text);
            }
            else
            {
                WriteCommentFast(ref utf8Text);
            }
        }
Exemplo n.º 3
0
        public void WriteValue(ReadOnlySpan <byte> utf8Text)
        {
            JsonWriterHelper.ValidateValue(ref utf8Text);

            if (JsonWriterHelper.IndexOfAnyEscape(utf8Text) != -1)
            {
                //TODO: Add escaping.
                utf8Text = JsonWriterHelper.EscapeStringValue(utf8Text);
            }

            if (_writerOptions.SlowPath)
            {
                WriteValueSlow(ref utf8Text);
            }
            else
            {
                WriteValueFast(ref utf8Text);
            }

            _currentDepth |= 1 << 31;
            _tokenType     = JsonTokenType.String;
        }
Exemplo n.º 4
0
        public void WriteComment(ReadOnlySpan <char> utf16Text)
        {
            JsonWriterHelper.ValidateValue(ref utf16Text);

            WriteCommentWithEncodingValue(MemoryMarshal.AsBytes(utf16Text));
        }