Exemplo n.º 1
0
 private void WriteIntoTarget(GZipStream compression)
 {
     for (long i = 0; i < _countOfBlocks; i++)
     {
         _OrderedByteBlock byteBlockToWrite;
         while (!_byteBlocksToCompress.TryGetAndRemove(i, out byteBlockToWrite))
         {
             continue;
         }
         compression.Write(byteBlockToWrite.Bytes, 0, byteBlockToWrite.Length);
         _byteBlockPool.Release(byteBlockToWrite.Bytes);
     }
 }
Exemplo n.º 2
0
        private void WriteIntoTarget(GZipStream compression)
        {
            for (long i = 0; i < _countOfBlocks; i++)
            {
                byte[] bytesToWrite;
                while (!_byteBlocksToCompress.TryGetAndRemove(i, out bytesToWrite))
                {
                    continue;
                }
                compression.Write(bytesToWrite, 0, bytesToWrite.Length);

                // аппендикс не возвращаем в пул, т.к. он был взят не оттуда
                if (i < _countOfBlocks - 1)
                {
                    _byteBlockPool.Release(bytesToWrite);
                }
            }
        }