This Java project implements file compression and decompression using the Deflate algorithm, which combines LZ77 and Huffman coding techniques. The program offers a command-line interface for compressing, decompressing, comparing file sizes, and checking if two files are equal.
- Compression (
comp): Compresses a given source file and outputs the result to an archive. - Decompression (
decomp): Decompresses a given archive and outputs the result to a specified file. - Size Comparison (
size): Displays the size of a specified file in bytes. - File Equality Check (
equal): Checks if two files are identical. - About Information (
about): Displays information about the developer.
| File name | File size (KB) | Comp. file size (KB) | Comp. ratio | Comp. coef. | Comp. time (ms) | Decomp. time (ms) |
|---|---|---|---|---|---|---|
| Java.html | 80.479 | 33.356 | 58.55 % | 2.41 | 663 | 67 |
| JavaScript.html | 344.523 | 107.19 | 68.89 % | 3.21 | 2544 | 64 |
| RTU.html | 83.069 | 30.93 | 62.77 % | 2.69 | 518 | 14 |
| Rainis.html | 206.694 | 57.458 | 72.20 % | 3.60 | 1321 | 17 |
| MonteCarlo.html | 612.88 | 100.359 | 83.63 % | 6.11 | 2331 | 23 |
Along with Main.java, the repository contains an examples folder with the following files:
- Java.html
- JavaScript.html
- RTU.html
- Rainis.html
- MonteCarlo.html
These files can be used to test and demonstrate the functionality of the compression and decompression features.
The following examples demonstrate some of the available commands:
- Compression:
- Input:
comp - Prompts:
- "source file name:" (e.g., File1.html)
- "archive name:" (e.g., File1.compressed)
- Description: Compresses File1.html and stores the compressed data in File1.compressed.
- Input:
- Decompression:
- Input:
decomp - Prompts:
- "archive name:" (e.g., File1.compressed)
- "file name:" (e.g., DecompressedFile1.html)
- Description: Decompresses File1.compressed and stores the decompressed content in DecompressedFile1.html.
- Input:
- Size Comparison:
- Input:
size - Prompts:
- "file name:" (e.g., File1.html)
- Description: Displays the size of File1.html in bytes.
- Input:
- File Equality Check:
- Input:
equal - Prompts:
- "first file name:" (e.g., File1.html)
- "second file name:" (e.g., DecompressedFile1.html)
- Description: Checks if File1.html and DecompressedFile1.html are identical.
- Input:
- About Information:
- Input:
about - Description: Displays information about the developer.
- Input:
This project was developed by Daniels Stulpe, a student at Riga Technical University.