Microsoft.Azure.Amqp.BufferListStream.Read C# (CSharp) 메소드

Read() 공개 메소드

public Read ( byte buffer, int offset, int count ) : int
buffer byte
offset int
count int
리턴 int
        public override int Read(byte[] buffer, int offset, int count)
        {
            this.ThrowIfDisposed();
            if (this.readArray == this.bufferList.Count)
            {
                return 0;
            }

            int bytesRead = 0;
            while (count > 0 && this.readArray < this.bufferList.Count)
            {
                ArraySegment<byte> segment = this.bufferList[this.readArray];
                int bytesRemaining = segment.Count - this.readOffset;
                int bytesToCopy = Math.Min(bytesRemaining, count);
                Buffer.BlockCopy(segment.Array, segment.Offset + this.readOffset, buffer, offset, bytesToCopy);

                this.Advance(bytesToCopy, segment.Count);
                count -= bytesToCopy;
                offset += bytesToCopy;
                bytesRead += bytesToCopy;
            }

            return bytesRead;
        }