Concatenate multiple zlib compressed data streams into a single stream efficiently

前端 未结 3 379
孤城傲影
孤城傲影 2020-12-20 18:59

If I have several binary strings with compressed zlib data, is there a way to efficiently combine them into a single compressed string without decompressing everyth

3条回答
  •  忘掉有多难
    2020-12-20 19:32

    In addition to gzjoin which requires decompression of the first deflate stream, you can take a look at gzlog.h and gzlog.c, which efficiently appends short strings to a gzip file without having to decompress the deflate stream each time. (It can be easily modified to operate on zlib-wrapped deflate data instead of gzip-wrapped deflate data.) You would use this approach if you are in control of the creation of the first deflate stream. If you are not creating the first deflate stream, then you would have to use the approach of gzjoin which requires decompression.

    None of the approaches require recompression.

提交回复
热议问题