The goal in this project is to write a file compression program. The program takes as input the name of a file, compresses it and writes the result as a new file.
The compression algorithm works as follows:
In Phase I, you are required to develop a simple compression program:
The skeleton of the classes for this project is as follows:
class Dictionary{
private LinkedListstrings;
// setters/getters/utility methods
}
class Compressor {
private Dictionary dict;
// Initializes the dictionary
public void initDictionary() {...}
// Compresses the file fileName
public void compress(String fileName) {...}
// setters/getters/utility methods
}
class TestCompressor {
public static void main(String[] args) {
Compressor cmp = new Compressor();
cmp.initDictionary();
long time = System.currentTimeMillis();
cmp.compress(args[0]);
time = System.currentTimeMillis() - time;
System.out.println(time + “ms”);
}
}