|
Xj3D VRML/X3D Code API | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.web3d.vrml.export.compressors.LZW
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:
There is no need to construct an LZW object, the LZW.Compress () and LZW.Expand () methods are static.
| Constructor Summary | |
LZW()
|
|
| Method Summary | |
static int |
Compress(byte[] inRaw,
CodeOutputPacker outComp)
Compress a sequence of raw data bytes. |
static int |
Compress(byte[] inRaw,
int validCount,
CodeOutputPacker outComp)
Compress a sequence of raw data bytes. |
static int |
Compress(java.io.InputStream inRaw,
CodeOutputPacker outComp)
|
static int |
Expand(CodeInputUnpacker inComp,
byte[] outExp)
Expand Compressed codes back to raw data. |
static int |
Expand(CodeInputUnpacker inComp,
java.io.OutputStream outExp)
Expand Compressed codes back to raw data. |
static void |
main(java.lang.String[] argv)
For test and demonstration. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public LZW()
| Method Detail |
public static int Compress(java.io.InputStream inRaw,
CodeOutputPacker outComp)
throws java.io.IOException
java.io.IOException
public static int Compress(byte[] inRaw,
CodeOutputPacker outComp)
throws java.io.IOException
inRaw - array of data bytes to be compressed,outComp - packer for destination for compressed data,
either to a stream or an array.
java.io.IOException - from underlying stream.
public static int Compress(byte[] inRaw,
int validCount,
CodeOutputPacker outComp)
throws java.io.IOException
inRaw - array of data bytes to be compressed,validCount - how much of inRaw array to be compressed,outComp - packer for destination for compressed data,
either to a stream or an array.
java.io.IOException - from underlying stream.
public static int Expand(CodeInputUnpacker inComp,
java.io.OutputStream outExp)
throws java.io.IOException,
java.lang.IllegalArgumentException
inComp - unpacker from source.outExp - destination for decoded bytes.
java.io.IOException - from either underlying stream.
java.lang.IllegalArgumentException - if input was not LZW compressed data.
public static int Expand(CodeInputUnpacker inComp,
byte[] outExp)
throws java.io.IOException,
java.lang.IllegalArgumentException
inComp - unpacker from source.outExp - destination for decoded bytes.
java.io.IOException - from either underlying stream.
java.lang.IllegalArgumentException - if input was not LZW compressed data.public static void main(java.lang.String[] argv)
|
Xj3D VRML/X3D Code API | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||