public static void UnHuff(Stream InStream, Stream OutStream) { int i = 0, count = 0; Tree t = new Tree (); BitIO bitIO = new BitIO (InStream, false); while ((i = bitIO.ReadBit ()) != 2) { if ((count = t.DecodeBinary (i)) != Tree.CharIsEof) OutStream.WriteByte ((byte)count); } }
public static void UnHuff(Stream InStream, Stream OutStream, UpdateCRC callback) { int i = 0, count = 0, sym; Tree t = new Tree (); BitIO bitIO = new BitIO (InStream, false); while ((i = bitIO.ReadBit ()) != 2) { if ((sym = t.DecodeBinary (i)) != Tree.CharIsEof) { OutStream.WriteByte ((byte)sym); callback (sym); count++; } } }