Gzip 内存压缩

发布于 2024-09-04 14:42:34 字数 173 浏览 1 评论 0原文

快速而简单的问题。

网上有关于使用 zlib (C++) 实现内存中 gzip 压缩而无需外部库(如 boost 等)的示例?

我只需要压缩和解压缩一块数据,没有太多选择。 (它必须是gzip,因为它与我的另一个C#程序使用的格式相同(数据是共享的))

尝试搜索无济于事... 谢谢!

Quick and simple question.

There are examples online about achieving in-memory gzip compression with zlib (C++) WITHOUT external libraries (like boost or such)?

I just need to compress and decompress a block of data without much options. (it must be gzip as its the same format used by another mine C# program (the data is to be shared))

Tried to search to no avail...
Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

我乃一代侩神 2024-09-11 14:42:34

您使用名为 zlib 的外部库。如果您不想将 DLL 与程序捆绑在一起,则可以静态链接该库。

zlib 与内存缓冲区配合良好。

您不需要提升。

You use an external library called zlib. You could statically link against this library if you did not want to bundle the DLL with your program.

zlib works happily with in-memory buffers.

You do not require boost.

濫情▎り 2024-09-11 14:42:34

这不是您问题的完整答案,但您可能会对 如何使用 zlib 解压缩 gzip 流?。为了使 zlib 能够与 gzip 流一起工作,您需要提供一些记录不足的魔法。

zlib API 有许多用于执行内存压缩的函数,这些函数不依赖于磁盘上的实际文件。

This isn't a complete answer to your question, but you will probably be interested in How can I decompress a gzip stream with zlib?. There is a little bit of poorly documented magic that you need to supply in order for zlib to work with gzip streams.

The zlib API has many functions for doing in-memory compression that don't depend on actual files on disk.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文