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.

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter8: I/o Streams And Data Files
Section8.4: File Streams As Function Arguments
Problem 3E
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
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
COMPREHENSIVE MICROSOFT OFFICE 365 EXCE
COMPREHENSIVE MICROSOFT OFFICE 365 EXCE
Computer Science
ISBN:
9780357392676
Author:
FREUND, Steven
Publisher:
CENGAGE L