Simple DEFLATE implementation
Overview
This project is a simple and compliant implementation of DEFLATE in Java. Currently available is a DEFLATE decompressor and a GZIP decompressor. The implementation is less than 1000 lines of well-commented code.
The DEFLATE format is a compression standard specified in RFC 1951 (plain text or PDF) in year 1996. The format has widespread use, and can be found in protocols and file formats such as ZIP, GZIP, PNG, HTTP, and Git. The GZIP container format is specified in RFC 1952 (plain text or PDF).
Source code
Browse the project’s source code at GitHub: https://github.com/nayuki/DEFLATE
Or download a ZIP of all the files: https://github.com/nayuki/DEFLATE/archive/master.zip
The code is open source under the MIT License. See the readme file for details.
The project package includes these main items:
Decompressor, which provides a library function to decompress a raw DEFLATE data stream (having no headers or wrappers).GzipDecompress, which is a command line program that decompresses a GZIP file. It handles the GZIP headers and footers, and uses the functionalityDecompressorfor the main data processing.A stripped-down version of Huffman coding from that project of mine.
Notes
DEFLATE is popular enough that essentially every important programming language has a library for it. For example, Java has java.util.zip.Deflater, Python has zlib, and zlib is available for C. While this project provides a compliant implementation, my code runs slowly and might have bugs, so it should be used as an educational tool only.