Beispiel #1
0
        private static HttpResponseMessage GetResponse(LineDTO[] lines)
        {
            var json       = JsonConvert.SerializeObject(lines);
            var compressed = Lz4.CompressString(json);

            return(new HttpResponseMessage
            {
                Content = new StringContent(compressed, Encoding.UTF8, "text/html")
            });
        }
Beispiel #2
0
        public void StringCompression_SimpleTest()
        {
            var txt = sampleTxt + sampleTxt + sampleTxt + sampleTxt + sampleTxt + sampleTxt;

            var comp = Lz4.CompressString(txt);
            var txt2 = Lz4.DecompressString(comp);

            Assert.IsTrue(txt == txt2);

            int sz1 = comp.Length;

            Assert.IsTrue(sz1 < txt.Length);

            comp = Lz4.CompressString(txt, Lz4Mode.HighCompression);
            txt2 = Lz4.DecompressString(comp);
            Assert.IsTrue(txt == txt2);

            Assert.IsTrue(sz1 >= comp.Length);
        }