System.Net.Http.ResponseStream.VerifyBuffer C# (CSharp) Method

VerifyBuffer() private static method

private static VerifyBuffer ( byte buffer, int offset, int count, bool allowEmpty ) : void
buffer byte
offset int
count int
allowEmpty bool
return void
        private static void VerifyBuffer(byte[] buffer, int offset, int count, bool allowEmpty)
        {
            if (buffer == null)
            {
                throw new ArgumentNullException(nameof(buffer));
            }
            if (offset < 0 || offset > buffer.Length)
            {
                throw new ArgumentOutOfRangeException(nameof(offset), offset, string.Empty);
            }
            if (count < 0 || count > buffer.Length - offset
                || (!allowEmpty && count == 0))
            {
                throw new ArgumentOutOfRangeException(nameof(count), count, string.Empty);
            }
        }