Redzen.IO.MemoryBlockStream.Trim C# (CSharp) Method

Trim() public method

Remove excess blocks from the block list.
public Trim ( ) : void
return void
        public void Trim()
        {
            int currBlockCount = _blockList.Count;
            int newBlockCount = _length / _blockSize;
            if(0 != (_length % _blockSize)) {
                newBlockCount++;
            }

            if(newBlockCount < currBlockCount) {
                _blockList.RemoveRange(newBlockCount, currBlockCount-newBlockCount);
            }
        }