System.Net.Cache.CombinedReadStream.Read C# (CSharp) Method

Read() public method

public Read ( byte buffer, int offset, int count ) : int
buffer byte
offset int
count int
return int
        public override int Read(byte[] buffer, int offset, int count) {

            try {
                if (Interlocked.Increment(ref m_ReadNesting) != 1) {
                    throw new NotSupportedException(SR.GetString(SR.net_io_invalidnestedcall, "Read", "read"));
                }

                if (m_HeadEOF) {
                    return m_TailStream.Read(buffer, offset, count);
                }
                else {
                    int result = m_HeadStream.Read(buffer, offset, count);
                    m_HeadLength += result;
                    if (result == 0 && count != 0) {
                        m_HeadEOF = true;
                        m_HeadStream.Close();
                        result = m_TailStream.Read(buffer, offset, count);
                    }
                    return result;
                }
            }
            finally {
                Interlocked.Decrement(ref m_ReadNesting);
            }

        }