放气的COM pression流去pre COM pressed数据可以插入。有没有一个.net LIB存在吗?存在、放气、数据、pression

2023-09-03 04:22:42 作者:痛定思痛。

我采取放气和gzip COM pression的网页内容。 .NET框架DeflateStream有很好的表现(它不COM preSS的好SharpZipLib,但它是非常快)。不幸的是(和所有其他库我知道)错过任何一个函数写preCOM pressed数据,如stream.Write preCOM pressed(byte []的缓冲区)。

I'm implementing Deflate and GZip compression for web content. The .NET Framework DeflateStream performs very well (it doesn't compress that good as SharpZipLib, but it is much faster). Unfortunately it (and all other libs i know) miss a function to write precompressed data like stream.WritePrecompressed(byte[] buffer).

使用此功能,有可能插入在流中preCOM pressed块。这可以减少CPU的负载为玉米pressing这部分并提高Web服务器的总吞吐量。

With this function it would be possible to insert precompressed blocks in the stream. This could reduce the cpu load for compressing this part and increase the total throughput of the web server.

有没有什么管理LIB能这样做吗?或者有没有什么好的起点,超越从ComponentAce ZLIB.NET做到这一点?

Is there any managed lib capable of doing this? Or is there any good starting point beyond ZLIB.NET from ComponentAce to do this?

推荐答案

另一种方法是刷新deflater流(并且也可能关闭它),以保证所有的缓冲玉米pressed数据写入到输出流,然后简单地重新写你的preCOM pressed数据底层输出流,然后重新打开你的输出流之上的deflater流。

Another approach is to flush the deflater stream (and possibly also close it), to guarantee that all buffered compressed data is written to the output stream, and then simply write your precompressed data to the underlying output stream, then re-open the deflater stream on top of your output stream again.