[ 
https://issues.apache.org/jira/browse/COMPRESS-243?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13833936#comment-13833936
 ] 

Damjan Jovanovic commented on COMPRESS-243:
-------------------------------------------

Ok, correction. Commenting writeClearCode() and writeEoiCode() out of 
MyLzwCompressor.compress(), changing initial_entries_count in 
MyLzwCompressor.initilizeStringTable() to "(1 << codeSize) + 1" (because there 
isn't an EOI in .Z files), using little endian byte order and initialCodeSize 
of 8 (which internally becomes 9 like we want) in the constructor parameters to 
that class, then prefixing the resulting stream with 0x1f 0x9d 0x8c, does end 
up writing a file which correctly decompresses with "compress" - up until the 
point where it starts using 10 bits per symbol, then decompression breaks.

Apart from those changes, to use commons-imaging's MyLzw package for ".Z" 
files, we'd also need at least maximum code size to be set dynamically instead 
of being hardcoded to 12, changes to make string construction and comparisons 
more efficient, and it needs to be a filter stream type interface instead of a 
blocking array -> array interface (which needs those string changes, since 
currently strings are stored as offset/length in the input array).

I'll continue to hack at it so long but please comment if you can help.

> Provide Compressor for classic Unix compress (maybe based on LZW codec from 
> imaging)
> ------------------------------------------------------------------------------------
>
>                 Key: COMPRESS-243
>                 URL: https://issues.apache.org/jira/browse/COMPRESS-243
>             Project: Commons Compress
>          Issue Type: New Feature
>            Reporter: Stefan Bodewig
>            Priority: Minor
>
> https://svn.apache.org/repos/asf/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/mylzw/



--
This message was sent by Atlassian JIRA
(v6.1#6144)

Reply via email to