Class LZW

java.lang.Object
org.web3d.vrml.export.compressors.LZW

public class LZW extends Object
The Limpel, Ziv, Welch (LZW) algorithm compresses any sequence of byte data. The resulting compressed codes are larger than bytes, but can each represent a group of bytes, at least some of the time, for what is usually an overall saving.

LZW compression recognizes sequences that have already appeared in the data, and replaces each later appearance by a unique code. The degree of compression depends on how much repetition is found in the data. LZW compression is effective with data having many and / or lengthy repeat sequences, such as text, and graphics with areas of solid color or patterns.

The sequence history should allow for the expected amount of repetition, without wasting too much space in each code on a history index. This version is fixed at 12 bit codes, which can refer to nearly a 2^^12 item sequence history, less some internal overhead. This size is considered good for short message blocks, and is simple to implement.

Note! Other versions of LZW may use other sizes of sequence history, and other coding conventions. They are not inter-operable with this algorithm.

The original papers:

  • Terry Welch, A Technique for High-Performance Data Compression, IEEE Computer, June 1984
  • J. Ziv and A. Lempel, A Universal Algorithm for Sequential Data Compression, IEEE Transactions on Information Theory, May 1977
This and many similar algorithms have been patented:
  • One form of the original LZ78 algorithm was patented (4,464,650) by its authors Lempel, Ziv, Cohn and Eastman. This patent is owned by Unisys.
  • The LZW algorithm used in 'compress' is patented, both by IBM (4,814,746) and Unisys (4,558,302).
This Java was ported from C code in the copyrighted article, "LZW Data Compression" by Mark Nelson, in Dr. Dobb's Journal October, 1989.

There is no need to construct an LZW object, the LZW.Compress () and LZW.Expand () methods are static.

Version:
$Revision: 1.2 $