Click here to Skip to main content
15,860,972 members
Articles / Programming Languages / Java / Java SE

LZW Compression Algorithm Implemented in Java

Rate me:
Please Sign up or sign in to vote.
3.82/5 (8 votes)
13 Aug 2006CPOL 166.2K   6.1K   10   27
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

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Web Developer
Singapore Singapore
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
Questionlzw decompression algorithm Pin
Member 1146051317-Feb-15 21:25
Member 1146051317-Feb-15 21:25 
QuestionNice topic Pin
sanya.fesak21-Sep-11 19:01
sanya.fesak21-Sep-11 19:01 
Generallzw in matlab Pin
hana.rahmati30-Apr-10 22:14
hana.rahmati30-Apr-10 22:14 
GeneralRe: lzw in matlab Pin
Taleb Dendachlii26-Nov-21 11:50
Taleb Dendachlii26-Nov-21 11:50 
Questionalgorithm for n-queen Pin
hana.rahmati30-Apr-10 21:38
hana.rahmati30-Apr-10 21:38 
GeneralI download your souce code and I have J creator and net beams install how do I run this file to test it Pin
Bulitpruf7-Aug-09 7:53
Bulitpruf7-Aug-09 7:53 
GeneralRe: I download your souce code and I have J creator and net beams install how do I run this file to test it Pin
mitesh355519-Jan-10 17:15
mitesh355519-Jan-10 17:15 
Generalhelp me to implementing the "dynamic markov compression of C version" to Java (JSDK) and J2me version.. :( Pin
bytescode28-Apr-09 1:39
bytescode28-Apr-09 1:39 
QuestionCan you also provide the decompression method Pin
pakhtoon18-Nov-07 12:43
pakhtoon18-Nov-07 12:43 
AnswerRe: Can you also provide the decompression method Pin
manishaswati30-Aug-08 3:26
manishaswati30-Aug-08 3:26 
AnswerRe: Can you also provide the decompression method Pin
duraigowardhan1-Oct-09 5:05
duraigowardhan1-Oct-09 5:05 
QuestionRe: Can you also provide the decompression method Pin
skumarmails17-Jan-10 22:47
skumarmails17-Jan-10 22:47 
AnswerRe: Can you also provide the decompression method Pin
guyver.nihilith14-Feb-10 5:24
guyver.nihilith14-Feb-10 5:24 
QuestionTABLE_SIZE Pin
GordonMorgan4-May-07 5:55
GordonMorgan4-May-07 5:55 
Generalurgent Pin
simarjeet26-Apr-07 5:47
simarjeet26-Apr-07 5:47 
GeneralRe: urgent Pin
Kusmadi Cakep8-Jan-10 20:35
Kusmadi Cakep8-Jan-10 20:35 
GeneralJ2ME for LZW Pin
fur12820-Mar-07 4:32
fur12820-Mar-07 4:32 
GeneralRe: J2ME for LZW Pin
ed welch3-Jun-07 7:47
ed welch3-Jun-07 7:47 
I didn't try to run it, but I can't see anything there that would stop it from being run on j2me
GeneralLZW in VC++ Pin
mannur28-Feb-07 4:27
mannur28-Feb-07 4:27 
Generalrequest Pin
rancidbondut19-Feb-07 8:03
rancidbondut19-Feb-07 8:03 
GeneralRe: LZW for J2ME Pin
fahadkhowaja16-Feb-07 2:09
fahadkhowaja16-Feb-07 2:09 
Generallzw for j2me Pin
scntuan10-Sep-06 7:26
scntuan10-Sep-06 7:26 
GeneralCongratulations and to follow !!! Pin
Pipa_Soft15-Aug-06 5:41
Pipa_Soft15-Aug-06 5:41 
GeneralRe: Congratulations and to follow !!! Pin
pakhtoon18-Nov-07 12:47
pakhtoon18-Nov-07 12:47 
GeneralRe: Congratulations and to follow !!! Pin
skumarmails17-Jan-10 22:34
skumarmails17-Jan-10 22:34 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.