コード例 #1
0
        private void OverflowToPersistentStream()
        {
            Stream persistentStream = CreatePersistentStream(_forAsync);

            persistentStream.SetLength(UnderlyingStream.Length);

            UnderlyingStream.Position = 0;
            UnderlyingStream.CopyTo(persistentStream);
            UnderlyingStream = persistentStream;
            _isInMemory      = false;
        }
コード例 #2
0
        public object Clone()
        {
            Stream clonedStream;

            if (_isInMemory)
            {
                clonedStream = new MemoryStream((int)UnderlyingStream.Length);
            }
            else
            {
                clonedStream = CreatePersistentStream(_forAsync);
                clonedStream.SetLength(this.Length);
            }

            UnderlyingStream.CopyTo(clonedStream);
            clonedStream.Position = 0L;

            return(new VirtualStream(_threshholdSize, _memoryStatus, clonedStream, _forAsync));
        }