Example #1
0
 protected override void CompressOrDecompressLogic(object i, DataBlockModel buffer)
 {
     using (var memoryStream = new MemoryStream(buffer.CompressedDataBuffer))
     {
         using (var gZipStream = new GZipStream(memoryStream, CompressionMode.Decompress))
         {
             gZipStream.Read(buffer.DataBuffer, 0, buffer.DataBuffer.Length);
             var block = new DataBlockModel(buffer.IdBlock, buffer.DataBuffer.ToArray());
             QueueFromWriter.AddDataToWriting(block);
         }
     }
 }
Example #2
0
        protected override void CompressOrDecompressLogic(object i, DataBlockModel buffer)
        {
            using (var memoryStream = new MemoryStream())
            {
                using (var gZipStream = new GZipStream(memoryStream, CompressionMode.Compress, true))
                {
                    gZipStream.Write(buffer.DataBuffer, 0, buffer.DataBuffer.Length);
                }
                byte[] compressedData = memoryStream.ToArray();
                var    compressBuffer = new DataBlockModel(buffer.IdBlock, compressedData);
                QueueFromWriter.AddDataToWriting(compressBuffer);
            }
            var doneManualResetEvents = manualResetEvents[(int)i];

            doneManualResetEvents.Set();
        }