コード例 #1
0
        private void AllocNextChunk(int minimumChunkSize)
        {
            int newChunkSize;

            if (_currentChunk.Length > (int.MaxValue / 2))
            {
                newChunkSize = int.MaxValue;
            }
            else
            {
                newChunkSize = _currentChunk.Length * 2;
            }
            if (minimumChunkSize > newChunkSize)
            {
                newChunkSize = minimumChunkSize;
            }
            byte[] newChunk = _bufferManager.TakeBuffer(newChunkSize);
            if (_chunkCount == _chunks.Length)
            {
                byte[][] newChunks = new byte[_chunks.Length * 2][];
                Array.Copy(_chunks, newChunks, _chunks.Length);
                _chunks = newChunks;
            }
            _chunks[_chunkCount++] = newChunk;
            _currentChunk          = newChunk;
            _currentChunkSize      = 0;
        }
コード例 #2
0
 public void Reinitialize(int initialSize, int maxSizeQuota, int effectiveMaxSize, InternalBufferManager bufferManager)
 {
     this.maxSizeQuota     = maxSizeQuota;
     this.maxSize          = effectiveMaxSize;
     this.bufferManager    = bufferManager;
     this.currentChunk     = bufferManager.TakeBuffer(initialSize);
     this.currentChunkSize = 0;
     this.totalSize        = 0;
     this.chunkCount       = 1;
     this.chunks[0]        = this.currentChunk;
     this.initialized      = true;
 }
コード例 #3
0
 public void Reinitialize(int initialSize, int maxSizeQuota, int effectiveMaxSize, InternalBufferManager bufferManager)
 {
     Fx.Assert(!this.initialized, "Clear must be called before re-initializing stream");
     this.maxSizeQuota     = maxSizeQuota;
     this.maxSize          = effectiveMaxSize;
     this.bufferManager    = bufferManager;
     this.currentChunk     = bufferManager.TakeBuffer(initialSize);
     this.currentChunkSize = 0;
     this.totalSize        = 0;
     this.chunkCount       = 1;
     this.chunks[0]        = this.currentChunk;
     this.initialized      = true;
 }
コード例 #4
0
ファイル: BufferedOutputStream.cs プロジェクト: nickchal/pash
		public void Reinitialize(int initialSize, int maxSizeQuota, int effectiveMaxSize, InternalBufferManager bufferManager)
		{
			this.maxSizeQuota = maxSizeQuota;
			this.maxSize = effectiveMaxSize;
			this.bufferManager = bufferManager;
			this.currentChunk = bufferManager.TakeBuffer(initialSize);
			this.currentChunkSize = 0;
			this.totalSize = 0;
			this.chunkCount = 1;
			this.chunks[0] = this.currentChunk;
			this.initialized = true;
		}
コード例 #5
0
 public void Reinitialize(int initialSize, int maxSizeQuota, int effectiveMaxSize, InternalBufferManager bufferManager)
 {
     Fx.Assert(!this.initialized, "Clear must be called before re-initializing stream");
     this.maxSizeQuota = maxSizeQuota;
     this.maxSize = effectiveMaxSize;
     this.bufferManager = bufferManager;
     this.currentChunk = bufferManager.TakeBuffer(initialSize);
     this.currentChunkSize = 0;
     this.totalSize = 0;
     this.chunkCount = 1;
     this.chunks[0] = this.currentChunk;
     this.initialized = true;
 }