Maven module :un.api : api-encoding :
Class :
un.impl.io.lzss.LZSSInputStream
Extends/Implements :
un.api.io.WrapInputStream
Subclasses : -
Variables : -
Functions :
LZSSInputStream,
read,
read
public void
LZSSInputStream (ByteInputStream in)
public int
read (byte[] buffer, int offset, int length)
public int
read ()
Derivate from LZ77 compression.
This compression algorithm is based on the ideas of Lempel and Ziv,
with the modifications suggested by Storer and Szymanski. The algorithm
is based on the use of a ring buffer, which initially contains zeros.
We read several characters from the file into the buffer, and then
search the buffer for the longest string that matches the characters
just read, and output the length and position of the match in the buffer.
With a buffer size of 4096 bytes, the position can be encoded in 12
bits. If we represent the match length in four bits, the
two characters, then we send just one character without encoding, and
restart the process with the next letter. We must send one extra bit
each time to tell the decoder whether we are sending a
an eight bit mask every eight items.
This implementation uses binary trees to speed up the search for the
longest match.
Original code by Haruhiko Okumura, 4/6/1989.
12-2-404 Green Heights, 580 Nagasawa, Yokosuka 239, Japan.
Modified for use in the Allegro filesystem by Shawn Hargreaves.
Use, distribute, and modify this code freely.
References :
http://en.wikipedia.org/wiki/Lempel-Ziv-Storer-Szymanski
Source available in public domain :
http://home.worldonline.cz/~cz210552/lzss.html
http://en.pudn.com/downloads121/sourcecode/java/detail516351_en.html (web cache of the above link)
http://mednafen.sourceforge.net/junk/compress.cpp
@author Haruhiko Okumura
@author Shawn Hargreaves
@author Johann Sorel (Adapted to Unlicense-lib)