Part I: Write a program to compress a source file into a target file using the Huffman coding method. First, use ObjectOutputStream to output the Huffman codes into the target file, then use BitOutputStream from Assignment #2 to output the encoded binary contents to the target file. Pass the files from the command line using something like the following command: C:\Users\.... > java Compress_a_File sourceFile.txt compressedFile.txt When I did this for my source file, I got a compressed file that looked something like the following: í w Zur [Ljava.lang.String;ÒVçé{G xp ppppppppppt 01101ppt 11010ppppppppppppppppppt 100pppppppppppt 10101pt 1111010ppppppppppppppppppt 011000pppppppppPPPPPPpt 1010011pt 1111011pt 1101110ppppppppppt 110110t 1101111t 00000t 01111 010t 101000pt 00001t 11111ppt 01110t 00010t 00011t 1110t 111100pt 1011t 001t 1100t 011001pppt 1010010pppppppppppppppPPPPPPPPpppppppppppppppppppppppPPPPPPPPppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppw 0§Ãµiów MieWM÷ttËDÏÌ£ïUÓXæ-...gògw Part II: Write a second program, Decompress_a_File.java, to decompress a previously compressed file so that it replicates the original source file in Part I above. You would do this at the command line with a command that looks like the following: C:\Users\...> java Decompress_a_File compressedFile.txt decompressedFile.txt When I ran this second program on my compressed file from Part I above I got: Roses are red, Violets are blue, Try to compress this file, And then decompress it too.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

use java

Part I: Write a program to compress a source file into a target file using the Huffman coding method. First,
use ObjectOutputStream to output the Huffman codes into the target file, then use BitOutputStream from Assignment
#2 to output the encoded binary contents to the target file. Pass the files from the command line using something like
the following command:
C:\Users\.... > java Compress_a_File sourceFile.txt compressedFile.txt
When I did this for my source file, I got a compressed file that looked something like the following:
í w Zur [Ljava.lang.String;ÒVçé{G xp ppppppppppt 01101ppt 11010ppppppppppppppppppt 100pppppppppppt
10101pt 1111010ppppppppppppppppppt 011000pppppppppPPPPPPpt 1010011pt 1111011pt 1101110ppppppppppt
110110t 1101111t 00000t 01111 010t 101000pt 00001t 11111ppt 01110t 00010t 00011t 1110t 111100pt 1011t
001t 1100t 011001pppt
1010010pppppppppppppppPPPPPPPPpppppppppppppppppppppppPPPPPPPPppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppw
0§Ãµiów MieWM÷ttËDÏÌ£ïUÓXæ-...gògw
Part II: Write a second program, Decompress_a_File.java, to decompress a previously compressed file so that it
replicates the original source file in Part I above. You would do this at the command line with a command that looks like
the following:
C:\Users\...> java Decompress_a_File compressedFile.txt decompressedFile.txt
When I ran this second program on my compressed file from Part I above I got:
Roses are red,
Violets are blue,
Try to compress this file,
And then decompress it too.
Transcribed Image Text:Part I: Write a program to compress a source file into a target file using the Huffman coding method. First, use ObjectOutputStream to output the Huffman codes into the target file, then use BitOutputStream from Assignment #2 to output the encoded binary contents to the target file. Pass the files from the command line using something like the following command: C:\Users\.... > java Compress_a_File sourceFile.txt compressedFile.txt When I did this for my source file, I got a compressed file that looked something like the following: í w Zur [Ljava.lang.String;ÒVçé{G xp ppppppppppt 01101ppt 11010ppppppppppppppppppt 100pppppppppppt 10101pt 1111010ppppppppppppppppppt 011000pppppppppPPPPPPpt 1010011pt 1111011pt 1101110ppppppppppt 110110t 1101111t 00000t 01111 010t 101000pt 00001t 11111ppt 01110t 00010t 00011t 1110t 111100pt 1011t 001t 1100t 011001pppt 1010010pppppppppppppppPPPPPPPPpppppppppppppppppppppppPPPPPPPPppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppw 0§Ãµiów MieWM÷ttËDÏÌ£ïUÓXæ-...gògw Part II: Write a second program, Decompress_a_File.java, to decompress a previously compressed file so that it replicates the original source file in Part I above. You would do this at the command line with a command that looks like the following: C:\Users\...> java Decompress_a_File compressedFile.txt decompressedFile.txt When I ran this second program on my compressed file from Part I above I got: Roses are red, Violets are blue, Try to compress this file, And then decompress it too.
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education