public static byte[] Decompress(byte[] data)
 {
     byte[] dhf  = HuffmanCoding.Decode(data);
     byte[] imtf = MoveToFrontCoding.Decode(dhf);
     byte[] ibw  = BurrowsWheelerTransform.InverseTransform(imtf);
     return(ibw);
 }
 public static byte[] Compress(byte[] Data)
 {
     byte[] bw  = BurrowsWheelerTransform.Transform(Data);
     byte[] mtf = MoveToFrontCoding.Encode(bw);
     byte[] hf  = HuffmanCoding.Encode(mtf);
     return(hf);
 }
Exemple #3
0
        public void TestDecode()
        {
            byte[] decoded1 = MoveToFrontCoding.Decode(Output1);
            Assert.AreEqual(Input1, ByteArrToString(decoded1));

            byte[] decoded2 = MoveToFrontCoding.Decode(Output2);
            Assert.AreEqual(Input2, ByteArrToString(decoded2));
        }
Exemple #4
0
        public void TestEncode()
        {
            byte[] encoded1 = MoveToFrontCoding.Encode(StringToByteArr(Input1));
            Assert.AreEqual(ByteArrToString(Output1), ByteArrToString(encoded1));

            byte[] encoded2 = MoveToFrontCoding.Encode(StringToByteArr(Input2));
            Assert.AreEqual(ByteArrToString(Output2), ByteArrToString(encoded2));
        }