Revenj.Utility.ChunkedMemoryStream.CopyTo C# (CSharp) Method

CopyTo() public method

public CopyTo ( ChunkedMemoryStream other ) : void
other ChunkedMemoryStream
return void
        public void CopyTo(ChunkedMemoryStream other)
        {
            other.CurrentPosition = CurrentPosition;
            var total = TotalSize >> BlockShift;
            var remaining = TotalSize & BlockAnd;
            if (other.TotalSize < total)
            {
                for (int i = other.Blocks.Count; i < total; i++)
                    other.Blocks.Add(new byte[BlockSize]);
            }
            for (int i = 0; i < total; i++)
                Buffer.BlockCopy(Blocks[i], 0, other.Blocks[i], 0, BlockSize);
            Buffer.BlockCopy(Blocks[total], 0, other.Blocks[total], 0, remaining);
        }

Same methods

ChunkedMemoryStream::CopyTo ( Stream stream ) : void
ChunkedMemoryStream::CopyTo ( byte target, int offset ) : void