Exemple #1
0
        /// <summary>Writes a binary context entry to the frame with the given key and value.</summary>
        /// <param name="key">The binary context entry key.</param>
        /// <param name="value">The binary context entry value.</param>
        /// <exception cref="NotSupportedException">If the frame protocol doesn't support binary context.</exception>
        /// <exception cref="ArgumentException">If the key is already in use.</exception>
        public void AddBinaryContextEntry(int key, ReadOnlySpan <byte> value)
        {
            OutputStream ostr = StartBinaryContext();

            if (AddKey(key))
            {
                ostr.WriteBinaryContextEntry(key, value);
            }
            else
            {
                throw new ArgumentException($"key `{key}' is already in use", nameof(key));
            }
        }
Exemple #2
0
        /// <summary>Writes a binary context entry to the frame with the given key and value.</summary>
        /// <param name="key">The binary context entry key.</param>
        /// <param name="value">The value to marshal as the binary context entry value.</param>
        /// <param name="writer">The writer used to marshal the value.</param>
        /// <exception cref="NotSupportedException">If the frame protocol doesn't support binary context.</exception>
        /// <exception cref="ArgumentException">If the key is already in use.</exception>
        public void AddBinaryContextEntry <T>(int key, T value, OutputStreamWriter <T> writer)
        {
            OutputStream ostr = StartBinaryContext();

            if (AddKey(key))
            {
                ostr.WriteBinaryContextEntry(key, value, writer);
            }
            else
            {
                throw new ArgumentException($"key `{key}' is already in use", nameof(key));
            }
        }