简体   繁体   English

Java Deflater中的SYNC_FLUSH / FULL_FLUSH参数:与DEFLATE块的关系?

[英]SYNC_FLUSH/FULL_FLUSH parameters in Java Deflater: relation to DEFLATE blocks?

In Java 7, Deflater has added support for some compression parameters (modes: FULL_FLUSH , SYNC_FLUSH ). 在Java 7中, Deflater增加了对某些压缩参数的支持(模式: FULL_FLUSHSYNC_FLUSH )。 I guess that they correspond to Zlib similar constants in the standard API (though this one has more modes). 我猜它们在标准API中对应于Zlib类似的常量 (尽管这个有更多的模式)。

My doubt is how those modes are related to the "blocks" of the DEFLATE stream (these blocks are compressed independently, except that a pointer inside a block might point to a raw substring of a previous block). 我怀疑这些模式是如何与DEFLATE流的“块”相关的(这些块是独立压缩的,除了块内的指针可能指向前一个块的原始子串)。

Does one (or both) of these modes implies that a flush terminates a (non final) DEFLATE block? 这些模式中的一个(或两个)是否暗示刷新终止(非最终)DEFLATE块? Can the caller predict and/or suggest these block boundaries? 调用者可以预测和/或建议这些块边界吗?

Specifically, I'd wish to tell the Deflater object the following: "I will feed you with N raw bytes in sections of predetermined length ( M ), and because I know that these sections are quite long and statistically different, and because I know that there is little to loose and something to gain in compressing them independently, I suggest you that compress them in separated DEFLATE blocks". 具体来说,我想告诉Deflater对象如下:“我会用预定长度( M )的部分给你N原始字节,因为我知道这些部分很长并且在统计上有所不同,因为我知道在单独压缩它们时几乎没有松动和获得的东西,我建议你在分离的DEFLATE块中压缩它们“。 Can I do this? 我可以这样做吗?

Yes, both flushes terminate the current block after the provided input data. 是的,两个刷新都在提供的输入数据之后终止当前块。

FULL_FLUSH furthermore prevents the following blocks from using matching strings in the blocks before it. 此外, FULL_FLUSH防止以下块在其之前的块中使用匹配的字符串。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM