ZlibCodecFactory Class — netty Architecture
Architecture documentation for the ZlibCodecFactory class in ZlibCodecFactory.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD a6964d7c_841a_507d_7866_99d7908d0f6e["ZlibCodecFactory"] b4987e80_61a9_b793_3660_83f0a5a9f7b3["ZlibCodecFactory.java"] a6964d7c_841a_507d_7866_99d7908d0f6e -->|defined in| b4987e80_61a9_b793_3660_83f0a5a9f7b3 f03fca3c_29e5_4b8b_8705_1f16628be5c2["isSupportingWindowSizeAndMemLevel()"] a6964d7c_841a_507d_7866_99d7908d0f6e -->|method| f03fca3c_29e5_4b8b_8705_1f16628be5c2 69042866_083e_b22d_fd08_c84e6f785e7d["ZlibEncoder()"] a6964d7c_841a_507d_7866_99d7908d0f6e -->|method| 69042866_083e_b22d_fd08_c84e6f785e7d ad0d7732_57bb_dbae_a1cc_b0ea99bc472f["ZlibDecoder()"] a6964d7c_841a_507d_7866_99d7908d0f6e -->|method| ad0d7732_57bb_dbae_a1cc_b0ea99bc472f f070f474_43c1_cba5_9c9c_668559cb3086["ZlibCodecFactory()"] a6964d7c_841a_507d_7866_99d7908d0f6e -->|method| f070f474_43c1_cba5_9c9c_668559cb3086
Relationship Graph
Source Code
codec-compression/src/main/java/io/netty/handler/codec/compression/ZlibCodecFactory.java lines 26–205
public final class ZlibCodecFactory {
private static final InternalLogger logger = InternalLoggerFactory.getInstance(ZlibCodecFactory.class);
private static final int DEFAULT_JDK_WINDOW_SIZE = 15;
private static final int DEFAULT_JDK_MEM_LEVEL = 8;
private static final boolean noJdkZlibDecoder;
private static final boolean noJdkZlibEncoder;
private static final boolean JZLIB_AVAILABLE;
static {
noJdkZlibDecoder = SystemPropertyUtil.getBoolean("io.netty.noJdkZlibDecoder", false);
logger.debug("-Dio.netty.noJdkZlibDecoder: {}", noJdkZlibDecoder);
noJdkZlibEncoder = SystemPropertyUtil.getBoolean("io.netty.noJdkZlibEncoder", false);
logger.debug("-Dio.netty.noJdkZlibEncoder: {}", noJdkZlibEncoder);
boolean jzlibAvailable;
try {
Class.forName("com.jcraft.jzlib.JZlib", false,
PlatformDependent.getClassLoader(ZlibCodecFactory.class));
jzlibAvailable = true;
} catch (ClassNotFoundException t) {
jzlibAvailable = false;
logger.debug(
"JZlib not in the classpath; the only window bits supported value will be " +
DEFAULT_JDK_WINDOW_SIZE);
}
JZLIB_AVAILABLE = jzlibAvailable;
}
/**
* Returns {@code true} if specify a custom window size and mem level is supported.
*/
public static boolean isSupportingWindowSizeAndMemLevel() {
return JZLIB_AVAILABLE;
}
public static ZlibEncoder newZlibEncoder(int compressionLevel) {
if (noJdkZlibEncoder) {
return new JZlibEncoder(compressionLevel);
} else {
return new JdkZlibEncoder(compressionLevel);
}
}
public static ZlibEncoder newZlibEncoder(ZlibWrapper wrapper) {
if (noJdkZlibEncoder) {
return new JZlibEncoder(wrapper);
} else {
return new JdkZlibEncoder(wrapper);
}
}
public static ZlibEncoder newZlibEncoder(ZlibWrapper wrapper, int compressionLevel) {
if (noJdkZlibEncoder) {
return new JZlibEncoder(wrapper, compressionLevel);
} else {
return new JdkZlibEncoder(wrapper, compressionLevel);
}
}
public static ZlibEncoder newZlibEncoder(ZlibWrapper wrapper, int compressionLevel, int windowBits, int memLevel) {
if (noJdkZlibEncoder ||
windowBits != DEFAULT_JDK_WINDOW_SIZE || memLevel != DEFAULT_JDK_MEM_LEVEL) {
return new JZlibEncoder(wrapper, compressionLevel, windowBits, memLevel);
} else {
return new JdkZlibEncoder(wrapper, compressionLevel);
}
}
public static ZlibEncoder newZlibEncoder(byte[] dictionary) {
if (noJdkZlibEncoder) {
return new JZlibEncoder(dictionary);
} else {
return new JdkZlibEncoder(dictionary);
}
}
public static ZlibEncoder newZlibEncoder(int compressionLevel, byte[] dictionary) {
Source
Frequently Asked Questions
What is the ZlibCodecFactory class?
ZlibCodecFactory is a class in the netty codebase, defined in codec-compression/src/main/java/io/netty/handler/codec/compression/ZlibCodecFactory.java.
Where is ZlibCodecFactory defined?
ZlibCodecFactory is defined in codec-compression/src/main/java/io/netty/handler/codec/compression/ZlibCodecFactory.java at line 26.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free