Zip() public static method

public static Zip ( byte bytes ) : byte[]
bytes byte
return byte[]
示例#1
0
        private IEnumerable <Message> CreateGzipCompressedMessage(IEnumerable <Message> messages)
        {
            var messageSet = Message.EncodeMessageSet(messages);

            var gZipBytes = Compression.Zip(messageSet);

            var compressedMessage = new Message
            {
                Attribute = (byte)(0x00 | (ProtocolConstants.AttributeCodeMask & (byte)MessageCodec.CodecGzip)),
                Value     = gZipBytes
            };

            return(new[] { compressedMessage });
        }
        private CompressedMessageResult CreateGzipCompressedMessage(IEnumerable <Message> messages)
        {
            var messageSet = Message.EncodeMessageSet(messages);

            var gZipBytes = Compression.Zip(messageSet);

            var compressedMessage = new Message
            {
                Attribute = (byte)(0x00 | (ProtocolConstants.AttributeCodeMask & (byte)MessageCodec.CodecGzip)),
                Value     = gZipBytes
            };

            return(new CompressedMessageResult
            {
                CompressedAmount = messageSet.Length - compressedMessage.Value.Length,
                CompressedMessage = compressedMessage
            });
        }