是否有任何主流压缩算法本身支持流数据

编程入门 行业动态 更新时间:2024-10-22 11:35:25
本文介绍了是否有任何主流压缩算法本身支持流数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

执行任何主流压缩算法,例如 snappy , zlib 或 bzip 本机支持通过网络流传输数据?例如,如果我必须发送压缩的有效负载,那么在发送消息之前,是否需要手动添加有效负载的大小?还是有任何库提供API来告知给定 x 个字节是否消息完整?

Does any mainstream compression algorithm, for example either snappy, zlib or bzip natively support streaming data across the network? For example if I have to send a compressed payload, then will I have to manually prepend the size of the payload before sending the message? Or does any library provide the API to tell whether a message is complete given x bytes?

推荐答案

zlib,bzip2,lz4,zstd,brotli,lzma2和其他许多文件都通过在压缩数据中使用数据结尾标记来支持流传输。

zlib, bzip2, lz4, zstd, brotli, lzma2, and many others all support streaming through the use of an end-of-data marker in the compressed data.

碰巧的是,您提到的其中一种快照式(snappy)不能按照您的要求进行流式传输,因为格式以未压缩的大小开头。

As it happens, one of the ones you mentioned, snappy, is not streamable in the sense you ask, since the format starts with an uncompressed size.

更多推荐

是否有任何主流压缩算法本身支持流数据

本文发布于:2023-10-16 05:42:07,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1496663.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:算法   有任何   主流   数据

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!