Git Product home page Git Product logo

filesqueeze's Introduction

FileSqueeze

FileSqueeze is a Huffman Coding-Based File Compression Program. It takes in a file and compresses it. Then it can take that folder and decompress it back into the original file. On Average, the Compression ratio is about 0.68 (compressed file / original file).

How it Works

FileSqueeze utilizes the Huffman Coding Algorithm to compress files. The program first reads in the file and counts the number of occurrences of each character. Then it creates a Huffman Tree based on the character counts. The program then traverses the tree and assigns a binary code to each character. The Tree is a min heap used as a priority queue, so the characters with the lowest counts are at the top of the tree. This means that the most frequent characters will have the shortest binary codes.

The program then writes the binary code to a file. The program also writes the character counts to the file so that the file can be decompressed. The program then reads in the binary code and writes the characters to a new file based on the Huffman Tree.

Requirements

  • The Program is written in Java, so the JVM must be installed on your machine to run this code

Usage

Encoding a File

java FileSqueeze.java -e <Path to File>

This command will create a .filesqueeze file with the same name as the original file. the original file is not deleted by the program.

Decoding a File

java FileSqueeze.java -d <Path to .filesqueeze file>

This command will create a new file with the name of the original file + "OUT.txt"

Example

java FileSqueeze.java -e "C:\Users\owens\OneDrive\Desktop\test.txt"

java FileSqueeze.java -d "C:\Users\owens\OneDrive\Desktop\test"

filesqueeze's People

Contributors

owenstrength avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.