Renci.SshNet.Common.SshDataStream.ReadBytes C# (CSharp) Method

ReadBytes() private method

Reads next specified number of bytes data type from internal buffer.
is greater than the internal buffer size.
private ReadBytes ( int length ) : byte[]
length int Number of bytes to read.
return byte[]
        private byte[] ReadBytes(int length)
        {
            var data = new byte[length];
            var bytesRead = Read(data, 0, length);

            if (bytesRead < length)
                throw new ArgumentOutOfRangeException("length",
                    string.Format(CultureInfo.InvariantCulture,
                        "The requested length ({0}) is greater than the actual number of bytes read ({1}).", length, bytesRead));

            return data;
        }