Click here to Skip to main content
Click here to Skip to main content
Go to top

LZW Compression Algorithm Implemented in Java

, 13 Aug 2006
Rate this:
Please Sign up or sign in to vote.
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)

Share

About the Author

fahadkhowaja
Web Developer
Singapore Singapore
No Biography provided

Comments and Discussions

 
Generalhelp me to implementing the "dynamic markov compression of C version" to Java (JSDK) and J2me version.. :( Pinmemberbytescode28-Apr-09 1:39 
Dear all,
 
I've a final project of my college about implementing DMC (Dynamic Markov Compression) algorithm using Java (JSDk) and java J2me.
 
I've found the source of this algorithm (DMC), but it write using C version :
ftp://ftp.sac.sk/pub/sac/pack/dmc.zip --> I've using this, but it's more complex Frown | :( But when I'm trying it, it run well and give the good result.
ftp://ftp.sac.sk/pub/sac/pack/dmcsrc.zip --> I haven't try it. It contain only C file and I don't know how to do that... Frown | :(
 
And, I'm try to "translate" DMC of C version (according example of ftp://ftp.sac.sk/pub/sac/pack/dmc.zip), but it only run well at compression. It failed when decompression Frown | :(
 
But, I thinks, both of compression and decompression (of my script- DMC Java version-) is wrong. I judge that because when I'm compare the ouptput text file of DMC (C version) and dmc (java version), each of output text file contain the different character (Theory said that if it same algorithm, it must be the same output and also the same character in it) Frown | :(
 
If you want to know my source 9and also help me to solve this problem), the URL is :
http://www.2shared.com/file/5426100/bc28341d/all_DMC_file.html
 
help me please. Thanks.
 
bytescode
(bytescode@telkom.net)

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

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

| Advertise | Privacy | Mobile
Web02 | 2.8.140916.1 | Last Updated 13 Aug 2006
Article Copyright 2006 by fahadkhowaja
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid