Write a program according to the specifications found below, that: Compresses a text file into a
Question:
Write a program according to the specifications found below, that:
• Compresses a text file into a Huffman-encoded file, generating the symbol frequency file for that particular text file
• Decodes a Huffman-encoded file into a text file, using the symbol frequency file for that particular file .
I need help to write the following class.
Class EncodingData.java:
This class is for you to write and represents a single pair of the data used to encode a text message into its binary Huffman code (a symbol and its corresponding binary Huffman code). It will be used for encoding a text file. Your implementation of the Encoding Data class must include the following, with the method headers as specified:
Attributes:
Private char symbol: a symbol that is to be encoded private String encoding: the binary Huffman code of the symbol (i.e. a string of 0’s and 1’s) Constructor: public Encoding Data(char symbol, String encoding) Public methods:
• Get Symbol(), get Encoding(), set Encoding(): getter and setter methods for both attributes
• Public boolean equals(Object obj): method that determines if two EncodingData objects are equal based on the symbol attribute (implement it in the same fashion as the equals(Object obj) in the class HuffmanPair)
• Public String toString(): method that gives a string representation of the symbol and its Huffman code
Introduction to Java Programming, Comprehensive Version
ISBN: 978-0133761313
10th Edition
Authors: Y. Daniel Liang