This project is a desktop-based Java application that performs Text File Compression and Decompression using Huffman Coding. Huffman Coding is an efficient greedy algorithm that reduces file size by encoding frequently used characters with shorter binary codes.
The application allows you to:
- Compress text files and reduce their size.
- Decompress files back to their original form.
- Compress any alphabetic string directly into a binary sequence.
The app uses the Huffman Tree to assign binary codes to characters based on their frequency in the input. Characters that appear more frequently are assigned shorter codes, resulting in an overall reduced file size.
- 📂 Select and Compress: Browse and compress any text file.
- 🔁 Decompress Files: Restore previously compressed files.
- 🧾 String Compression: Enter a string manually to get its Huffman-encoded binary.
- 🖥️ User-Friendly GUI: Simple and intuitive interface for all actions.
- 💾 Save Output: Choose location to save compressed or decompressed files.
- Clone or download the repository.
- Go to the
Executable/
folder. - Run:
EncoderGUI.jar
– Works on systems with Java installed.Encoder.exe
– Windows executable, no Java required.
- Open the project in any Java IDE like IntelliJ IDEA or Eclipse.
- Locate the
EncoderGUI.java
file in thesrc/
directory. - Run the
main()
method insideEncoderGUI
.
file-compression-system/ ├── Executable/ │ ├── EncoderGUI.jar │ └── Encoder.exe ├── src/ │ └── (All Java source files including EncoderGUI.java) ├── README.md └── ...
- Java – Main programming language
- Swing – For building the GUI
- File I/O – For reading/writing input and output files
- Huffman Coding Algorithm – For compression logic
Swastik Singh Chauhan
This project is for academic use only. Feel free to explore and modify it as needed.