ServiceStack.Text.RecyclableMemoryStream.Read C# (CSharp) Method

Read() public method

Reads from the current position into the provided buffer
buffer is null offset or count is less than 0 offset subtracted from the buffer length is less than count Object has been disposed
public Read ( byte buffer, int offset, int count ) : int
buffer byte Destination buffer
offset int Offset into buffer at which to start placing the read bytes.
count int Number of bytes to read.
return int
        public override int Read(byte[] buffer, int offset, int count)
        {
            this.CheckDisposed();
            if (buffer == null)
            {
                throw new ArgumentNullException("buffer");
            }

            if (offset < 0)
            {
                throw new ArgumentOutOfRangeException("offset", "offset cannot be negative");
            }

            if (count < 0)
            {
                throw new ArgumentOutOfRangeException("count", "count cannot be negative");
            }

            if (offset + count > buffer.Length)
            {
                throw new ArgumentException("buffer length must be at least offset + count");
            }

            int amountRead = this.InternalRead(buffer, offset, count, this.position);
            this.position += amountRead;
            return amountRead;
        }