Beispiel #1
0
 private void ValidatePropertyNameAndDepth(ref ReadOnlySpan <byte> propertyName)
 {
     // TODO: Use throw helper with proper error messages
     if (propertyName.Length > JsonConstants.MaxTokenSize || CurrentDepth >= JsonConstants.MaxWriterDepth)
     {
         JsonThrowHelper.ThrowJsonWriterOrArgumentException(propertyName, _currentDepth);
     }
 }
Beispiel #2
0
        public void WriteArray(ReadOnlySpan <byte> propertyName, ReadOnlySpan <DateTime> values)
        {
            // TODO: Use throw helper with proper error messages
            if (propertyName.Length > JsonConstants.MaxTokenSize || CurrentDepth >= JsonConstants.MaxPossibleDepth)
            {
                JsonThrowHelper.ThrowJsonWriterOrArgumentException(propertyName, _currentDepth);
            }

            if (_writerOptions.SlowPath)
            {
                WriteArraySlow(ref propertyName, ref values);
            }
            else
            {
                WriteArrayFast(ref propertyName, ref values);
            }

            _currentDepth |= 1 << 31;
            _tokenType     = JsonTokenType.EndArray;
        }
Beispiel #3
0
        private void WriteStart(ref ReadOnlySpan <byte> propertyName, byte token)
        {
            // TODO: Use throw helper with proper error messages
            if (propertyName.Length > JsonConstants.MaxTokenSize || CurrentDepth >= JsonConstants.MaxPossibleDepth)
            {
                JsonThrowHelper.ThrowJsonWriterOrArgumentException(propertyName, _currentDepth);
            }

            if (_writerOptions.SlowPath)
            {
                WriteStartSlow(ref propertyName, token);
            }
            else
            {
                WriteStartFast(ref propertyName, token);
            }

            _currentDepth &= JsonConstants.RemoveFlagsBitMask;
            _currentDepth++;
        }