blob: 295e890fbf0ebe3bf542c52168b2b7d27421ba2b (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
|
Welcome to TDDD86 Shrink-It!
This program uses the Huffman coding algorithm for compression.
Any file can be compressed by this method, often with substantial
savings. Decompression will faithfully reproduce the original.
1) build character frequency table
2) build encoding tree
3) build encoding map
4) encode data
5) decode data
C) compress file
D) decompress file
F) free tree memory
B) binary file viewer
T) text file viewer
S) side-by-side file comparison
Q) quit
Your choice? 1
Read from a s)tring or f)ile? f
File name to process: empty.txt
Building frequency table ...
256: EOF => 1
1 character frequencies found.
1) build character frequency table
2) build encoding tree
3) build encoding map
4) encode data
5) decode data
C) compress file
D) decompress file
F) free tree memory
B) binary file viewer
T) text file viewer
S) side-by-side file comparison
Q) quit
Your choice? 2
Building encoding tree ...
{EOF (256), count=1}
1) build character frequency table
2) build encoding tree
3) build encoding map
4) encode data
5) decode data
C) compress file
D) decompress file
F) free tree memory
B) binary file viewer
T) text file viewer
S) side-by-side file comparison
Q) quit
Your choice? 3
Building encoding map ...
256: EOF =>
1 character encodings found.
1) build character frequency table
2) build encoding tree
3) build encoding map
4) encode data
5) decode data
C) compress file
D) decompress file
F) free tree memory
B) binary file viewer
T) text file viewer
S) side-by-side file comparison
Q) quit
Your choice? 4
Reuse your previous string/file data for encoding? y
Encoding data ...
Here is the binary encoded data (0 bytes):
1) build character frequency table
2) build encoding tree
3) build encoding map
4) encode data
5) decode data
C) compress file
D) decompress file
F) free tree memory
B) binary file viewer
T) text file viewer
S) side-by-side file comparison
Q) quit
Your choice? c
Input file name: empty.txt
Output file name (Enter for empty.huf): empty.huf
Reading 0 uncompressed bytes.
Compressing ...
Wrote 7 compressed bytes.
1) build character frequency table
2) build encoding tree
3) build encoding map
4) encode data
5) decode data
C) compress file
D) decompress file
F) free tree memory
B) binary file viewer
T) text file viewer
S) side-by-side file comparison
Q) quit
Your choice? b
File name to display: empty.huf
Here is the binary encoded data (7 bytes):
11011110 01001100 10101100 01101100 01011100 10001100 10111110
1) build character frequency table
2) build encoding tree
3) build encoding map
4) encode data
5) decode data
C) compress file
D) decompress file
F) free tree memory
B) binary file viewer
T) text file viewer
S) side-by-side file comparison
Q) quit
Your choice? d
Input file name: empty.huf
Output file name (Enter for empty-out.txt): empty-out.txt
Reading 7 compressed bytes.
Decompressing ...
Wrote 0 decompressed bytes.
1) build character frequency table
2) build encoding tree
3) build encoding map
4) encode data
5) decode data
C) compress file
D) decompress file
F) free tree memory
B) binary file viewer
T) text file viewer
S) side-by-side file comparison
Q) quit
Your choice? t
File name to display: empty-out.txt
Here is the text data (0 bytes):
1) build character frequency table
2) build encoding tree
3) build encoding map
4) encode data
5) decode data
C) compress file
D) decompress file
F) free tree memory
B) binary file viewer
T) text file viewer
S) side-by-side file comparison
Q) quit
Your choice? q
Exiting.
|