Example #1
0
        public override void ProcessData()
        {
            while (!ReadedQueue.Completed() && !ForceStopped)
            {
                var bytesBlock = ReadedQueue.Pop();
                if (bytesBlock == null)
                {
                    continue;
                }

                using (var memoryStream = new MemoryStream(bytesBlock.BytesArray))
                {
                    using (var gZipStream = new GZipStream(memoryStream, CompressionMode))
                    {
                        var tempBytesArray   = new byte[BlockProcessingLength];
                        var readedBytesCount = gZipStream.Read(tempBytesArray, 0, tempBytesArray.Length);

                        var bytesArray = new byte[readedBytesCount];
                        Buffer.BlockCopy(tempBytesArray, 0, bytesArray, 0, readedBytesCount);

                        OutputQueue.Push(new BytesBlock(bytesBlock.OrderNum, bytesArray));
                    }
                }
            }
        }
Example #2
0
        public override void ProcessData()
        {
            while (!ReadedQueue.Completed() && !ForceStopped)
            {
                var bytesBlock = ReadedQueue.Pop();
                if (bytesBlock == null)
                {
                    continue;
                }

                using (var memoryStream = new MemoryStream())
                {
                    using (var gZipStream = new GZipStream(memoryStream, CompressionMode))
                        using (var binaryWriter = new BinaryWriter(gZipStream))
                        {
                            binaryWriter.Write(bytesBlock.BytesArray, 0, bytesBlock.BytesArray.Length);
                        }

                    OutputQueue.Push(new BytesBlock(bytesBlock.OrderNum, memoryStream.ToArray()));
                }
            }
        }