Esempio n. 1
0
        private bool EncodeFile(Stream inStream,
                                Stream outStream,
                                IBinaryTree <char> binaryTree,
                                Dictionary <char, string> codes)
        {
            inStream.Seek(0, SeekOrigin.Begin);
            if (binaryTree.GetType().GetCustomAttribute <SerializableAttribute>() == null)
            {
                return(false);
            }
            outStream.WriteByte(0); //Number of bits added at the end
            WriteBinaryHeap(outStream, binaryTree);
            CompressAndWrite(inStream, outStream, codes);

            return(true);
        }