Compressing two buffers

36 views
Skip to first unread message

Creo

unread,
Mar 30, 2021, 11:39:54 AM3/30/21
to LZ4c
Hi all,
I need to compress a message before sending it.

The message is composed of two separate buffers:
- a header of length hlen
- a buffer of length blen

How can I compress both buffers into a single stream?

Thanks a lot for the kind reply.

Cyan

unread,
Mar 31, 2021, 12:45:58 AM3/31/21
to LZ4c
The easiest method is to concatenate both contents in a single continuous buffer,
and then compress this buffer as a one-shot compression operation.
This is by far the easiest way.

Other methods exists (bufferless streaming, and full frame streaming)
but they are more complex, and come with a non trivial set of trade offs,
so I would rather not recommend to use them, 
they exist mostly for experts who know what they are doing (are fully aware of the trade offs involved).
Reply all
Reply to author
Forward
0 new messages