This is a simple tool written in Java for compressing effectively file directories using Huffman approach. Gui made with Swing and improved with FlatLaf.
The application is a graphical interface that allows to work with file directories including the possibility:
- Compress directories using Huffman coding.
- Decompress previously compressed directories.
- Command-line interface for easy use.
- Java 17
- Swing API
- FlatLaf 3.1.1
- Java: This application requires Java JDK 8 or higher. Ensure you have it installed by running:
java -version
- Maven: (Optional) If you wish to build the project from source, Maven is recommended for dependency management.
You can clone the repository to your local machine using Git. Open a terminal and run:
git clone https://github.com/Dev1Art/huffman-compressor.git
cd huffman-compressor
If you have Maven installed, you can build the project by running:
mvn clean package
This will compile the project and create a JAR file in the target directory.
If you prefer not to build the project yourself, you can download the latest JAR file from the target directory after building, or you can provide a link to a pre-built JAR file if available.
You can use the application via the command line. Here’s how:
To compress a text file, use the following command:
java -jar target/huffman-compressor.jar compress <input_dir> <output_dir>
- <input_dir>: The path to the directory you want to compress.
- <output_dir>: The path where you want to save the compressed file .huff.
To decompress a previously compressed directory, run:
java -jar target/huffman-compressor.jar decompress <input_dir> <output_dir>
- <input_dir>: The path to the directory of the compressed file.
- <output_dir>: The path where you want to save the decompressed directory.
You can find some directories for in-place tests in test_cases zip archive. So before the tests you should unpack it. Here is the example how you can test it:
java -jar target/huffman-compressor.jar compress BIG_PACK SAVES
java -jar target/huffman-compressor.jar decompress SAVES SAVES
Thanks to DanielDFY for his Huffman implementation that I used in my project. His work at https://github.com/DanielDFY/Huffman.
Contributions are welcome! If you would like to contribute, please fork the repository and make a pull request. For major changes, please open an issue first to discuss what you would like to change.
This project is licensed under the MIT License - see the LICENSE file for details.