windows Gzip 内存压缩
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2955220/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Gzip In-Memory Compression
提问by feal87
Quick and simple question.
快速而简单的问题。
There are examples online about achieving in-memory gzip compression with zlib (C++) WITHOUT external libraries (like boost or such)?
网上有关于在没有外部库(如 boost 等)的情况下使用 zlib (C++) 实现内存中 gzip 压缩的示例?
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))
我只需要压缩和解压缩一个数据块而没有太多选择。(它必须是gzip,因为它与另一个我的C#程序使用的格式相同(数据要共享))
Tried to search to no avail... Thanks!
试图搜索无济于事...谢谢!
采纳答案by Greg Hewgill
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.
这不是您问题的完整答案,但您可能会对如何使用 zlib 解压缩 gzip 流感兴趣?. 为了让 zlib 与 gzip 流一起工作,您需要提供一些记录不佳的魔法。
The zlib API has many functions for doing in-memory compression that don't depend on actual files on disk.
zlib API 有许多用于进行内存压缩的函数,这些函数不依赖于磁盘上的实际文件。