Maven module :un.api : api-encoding :
Class :
un.impl.io.lzss.LZSSOutputStream
Extends/Implements :
un.api.io.WrapOutputStream
Subclasses : -
Variables :
state,
i,
len,
r,
s,
c,
last_match_length,
code_buf_ptr,
mask,
code_buf,
match_position,
match_length,
lson,
rson,
dad,
text_buf
Functions :
LZSSOutputStream,
write,
write,
flush,
close
int
state
int
i
int
len
int
r
int
s
byte
c
int
last_match_length
int
code_buf_ptr
byte
mask
byte
code_buf
int
match_position
int
match_length
int
lson
int
rson
int
dad
byte
text_buf
void
LZSSOutputStream (ByteOutputStream out)
public void
write (byte zz, int ofs, int sz)
public void
write (byte b)
public void
flush ()
public void
close ()
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)
@author Haruhiko Okumura
@author Shawn Hargreaves
@author Johann Sorel (Adapted to Unlicense-lib)