質問

Of the possible DEFLATE compression levels [0 .. 9], which one exactly Java's Deflater.DEFAULT_COMPRESSION correspond to? In the Java source code, I see it as public static final int DEFAULT_COMPRESSION = -1;

役に立ちましたか?

解決 2

Z_DEFAULT_COMPRESSION is intended to be a good compromise between speed and compression effectiveness. It is the knee in the curve. The actual level that it's currently equivalent to, 6, is an internal choice that could change in future versions if the compression algorithm changes. So you should not depend on it remaining equivalent to level 6.

他のヒント

The java code uses the class new ZStreamRef(init(level, DEFAULT_STRATEGY, nowrap)); the init method is a native call and the ZStreamRef is a reference to zlib. So its what ever zlib uses as default. In the version 1.2.8 the default is 6 like devnull stated.

From the zlib manual

Compression levels.
#define Z_NO_COMPRESSION         0
#define Z_BEST_SPEED             1
#define Z_BEST_COMPRESSION       9
#define Z_DEFAULT_COMPRESSION  (-1)
...
 Z_DEFAULT_COMPRESSION requests a default compromise between speed and compression (currently equivalent to level 6).
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top