Exemplo n.º 1
0
        /// <summary>
        /// Create a <see cref="ReadableBuffer"/> over an array.
        /// </summary>
        public static ReadableBuffer Create(byte[] data, int offset, int length)
        {
            if (data == null)
            {
                PipelinesThrowHelper.ThrowArgumentNullException(ExceptionArgument.data);
            }

            OwnedBuffer <byte> buffer = data;

            return(Create(buffer, offset, length));
        }
Exemplo n.º 2
0
        /// <summary>
        /// Create a <see cref="ReadableBuffer"/> over an array.
        /// </summary>
        public static ReadableBuffer Create(byte[] data)
        {
            if (data == null)
            {
                PipelinesThrowHelper.ThrowArgumentNullException(ExceptionArgument.data);
            }

            OwnedBuffer <byte> buffer = data;

            return(CreateInternal(buffer, 0, data.Length));
        }
Exemplo n.º 3
0
        /// <summary>
        /// Create a <see cref="ReadableBuffer"/> over an OwnedBuffer.
        /// </summary>
        public static ReadableBuffer Create(OwnedBuffer <byte> data, int offset, int length)
        {
            if (data == null)
            {
                PipelinesThrowHelper.ThrowArgumentNullException(ExceptionArgument.data);
            }

            if (offset < 0)
            {
                PipelinesThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.offset);
            }

            if (length < 0 || length > data.Length - offset)
            {
                PipelinesThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.length);
            }

            return(CreateInternal(data, offset, length));
        }