Esempio n. 1
0
        public static string CompressStrings(string data, Encoding encoding = null, int windowLength = -1)
        {
            data.AssertHasText(nameof(data));
            encoding = encoding ?? Encoding.UTF8;
            byte[] inputData = encoding.GetBytes(data);

            LZ77 lz = new LZ77();

            byte[] compressed = lz.Compress(inputData, windowLength);
            return(encoding.GetString(compressed));
        }
Esempio n. 2
0
        public static byte[] CompressBytes(byte[] data, int windowLength = -1)
        {
            LZ77 lz = new LZ77();

            return(lz.Compress(data, windowLength));
        }