Microsoft.Azure.Amqp.BufferListStream.SetPosition C# (CSharp) Method

SetPosition() private method

private SetPosition ( long pos ) : void
pos long
return void
        void SetPosition(long pos)
        {
            if (pos < 0)
            {
                throw new ArgumentOutOfRangeException("position");
            }

            this.position = pos;
            int arrayIndex = 0;
            while (arrayIndex < this.bufferList.Count && pos > 0)
            {
                if (pos >= this.bufferList[arrayIndex].Count)
                {
                    pos -= this.bufferList[arrayIndex].Count;
                    ++arrayIndex;
                }
                else
                {
                    break;
                }
            }

            this.readArray = arrayIndex;
            this.readOffset = (int)pos;
        }