Skip to content

behniafb/Huffman-Coder-Decoder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Huffman-Coder-Decoder

Table of Contents
  1. About The Project
  2. How To Use

About The Project

This Java application can transform a .txt file into it's Huffman-coded compressed form(.cmp file), or vise versa. It is made by me, Behnia Farahbod, for my Data Structure's final project. Dedicated to @MRNafisiA , my friend and my Teacher's Assistant

Built With

How To Use

When you run the Main.java class, it asks you for input. You can choose 1 for encoding, or 2 for decoding.

For Encoding

The related files are mentioned in this part of the code:

// Encrypt
        if (1 == new Scanner(System.in).nextInt()) {
            BufferedWriter bw = new BufferedWriter(new FileWriter("src\\Huffman-Coded-Text.cmp", false));
            BufferedReader reader = new BufferedReader(new FileReader("src\\Text.txt"));

The address of the file that is going to be compressed is given currently src\\Text.txt, that is in src folder. And also the compressed file will be created in src\\Huffman-Coded-Text.cmp. You can have it wherever you want.

For Decoding

WARNING: You are ONLY ALLOWED to decode a compressed file, that was encoded before WITH THIS APP! Unless it should't work; at least without changes in some other lines of the code.

The related files are mentioned in this part of the code:

 // Decrypt
        else {
            BufferedWriter bw = new BufferedWriter(new FileWriter("src\\Huffman-Decoded-Text.txt", false));
            BufferedReader reader = new BufferedReader(new FileReader("src\\Huffman-Coded-Text.cmp"));

The address of the file that is going to be decoded is given currently src\\Huffman-Coded-Text.cmp, that is in src folder. And also the decoded file will be src\\Huffman-Decoded-Text.txt, located in src folder.

About

This console application, written in Java, can transform a .txt file into it's Huffman-coded compressed form(.cmp file) or vise versa .

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages