Beispiel #1
0
        public void Close()
        {
            byte[] theInput = byteOut.ToArray();
            Console.WriteLine("Read " + theInput.Length + " bytes");

            MemoryStream byteIn = new MemoryStream(theInput);

            CharCounter countObj = new CharCounter(byteIn);

            byteIn.Close();

            HuffmanTree codeTree = new HuffmanTree(countObj);

            codeTree.WriteEncodingTable(dout);

            BitOutputStream bout = new BitOutputStream(dout);

            for (int i = 0; i < theInput.Length; i++)
            {
                bout.WriteBits(codeTree.GetCode(theInput[i] & (0xff)));
            }
            bout.WriteBits(codeTree.GetCode(BitUtils.EOF));

            bout.Close();
            byteOut.Close();
        }
Beispiel #2
0
 public HuffmanTree(CharCounter cc)
 {
     theCounts = cc;
     root      = null;
     CreateTree();
 }
Beispiel #3
0
 public HuffmanTree()
 {
     theCounts = new CharCounter();
     root      = null;
 }