0
votes

It appears that deflateSetDictionary() can be called (a) only once with zlib formatted data, or (b) multiple times with the raw deflate format. Is my understanding correct?

With the raw option using multiple dictionary calls, how would compressor and decompressor agree on when to make the dictionary calls? I am imagining that they will agree in advance on some raw block size. Compressor will Z*FLUSH every block size then insert a dictionary, and decompressor will Z_BLOCK and insert a dictionary.

What is the typical use case (a) or (b)?

Here is the zlib.h excerpt https://github.com/madler/zlib/blob/master/zlib.h#L618

1

1 Answers

1
votes

Correct.

It is entirely up to you when to insert dictionaries, and how to indicate that in the data stream. There is no typical use case. As far as I know, zlib dictionaries are rarely used.