65.9K
CodeProject is changing. Read more.
Home

LZW Compression Algorithm Implemented in Java

starIconstarIconstarIcon
emptyStarIcon
starIcon
emptyStarIcon

3.82/5 (8 votes)

Aug 13, 2006

CPOL
viewsIcon

175346

downloadIcon

6084

This article provides an implementation of the LZW compression algorithm in Java

Introduction

I recently had the opportunity to look into compression for a project. I had to implement the Lempel-Ziv-Welch (LZW) algorithm for mobile phones in J2ME but before that, I implemented it in Java for testing purposes.

I wish to thank Mark Nelson for pointing out that the Unisys patent on this algorithm has expired, so there are fewer headaches in the use of this algorithm.

Description

This implementation is actually based on the C version of the implementation by Mark Nelson at http://marknelson.us/1989/10/01/lzw-data-compression/. Please refer to this website for further details about the algorithm. The Java adaptation is designed to work for ASCII encoded text files.

History

  • 13th August, 2006: Initial post