Crate compress

Crate compress 

Expand description

Unix compress LZW formats:

  • CompressLzw (compress 3.0+ / 4.0 / ncompress, magic 0x1F 0x9D, block mode)
  • CompressLzw2 (compress 2.0, magic 0x1F 0x9D, non-block mode)
  • CompressLzw1 (compress 1.0, headerless stream)

Specification reference: data/docs/compress-ncompress.md Reference decompressor: old/unix-tools/gzip-1.14/gzip-1.14/unlzw.c

Constants§

BIT_MASK
Maxbits mask in header byte 2 (0x1F).
BLOCK_MODE
Block mode mask bit in header byte 2 (0x80).
CLEAR_CODE
Special CLEAR code emitted in block mode to flush dictionary (256).
FIRST_FREE_BLOCK
First free dictionary entry in block mode (257).
FIRST_FREE_NONBLOCK
First free dictionary entry in non-block mode (256).
INIT_BITS
Initial bit width for LZW codes (9 bits).
LZW_MAGIC
Magic header bytes for .Z LZW compress format (0x1F, 0x9D).
LZW_RESERVED
Reserved bits in header byte 2 (0x60).
MAX_BITS
Default maximum bit width for LZW codes (16 bits).

Functions§

compress_lzw_stream
Compresses a stream using the specified LZW format variant (CompressLzw, CompressLzw2, CompressLzw1, CompressLzw16). Compresses a stream using the specified LZW format variant (CompressLzw, CompressLzw2, CompressLzw1, CompressLzw16).
decompress_lzw_stream
Decompresses a stream using the specified LZW format variant (CompressLzw, CompressLzw2, CompressLzw1, CompressLzw16).