1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package io.netty5.handler.codec.compression;
17
18 import io.netty5.channel.ChannelHandler;
19
20
21
22
23 public final class ZlibCodecFactory {
24 private static final boolean supportsWindowSizeAndMemLevel = true;
25
26
27
28
29 public static boolean isSupportingWindowSizeAndMemLevel() {
30 return supportsWindowSizeAndMemLevel;
31 }
32
33 public static ChannelHandler newZlibEncoder(int compressionLevel) {
34 return new CompressionHandler(ZlibCompressor.newFactory(compressionLevel));
35 }
36
37 public static ChannelHandler newZlibEncoder(ZlibWrapper wrapper) {
38 return new CompressionHandler(ZlibCompressor.newFactory(wrapper));
39 }
40
41 public static ChannelHandler newZlibEncoder(ZlibWrapper wrapper, int compressionLevel) {
42 return new CompressionHandler(ZlibCompressor.newFactory(wrapper, compressionLevel));
43 }
44
45 public static ChannelHandler newZlibEncoder(ZlibWrapper wrapper, int compressionLevel,
46 int windowBits, int memLevel) {
47 return new CompressionHandler(ZlibCompressor.newFactory(wrapper, compressionLevel));
48 }
49
50 public static ChannelHandler newZlibEncoder(byte[] dictionary) {
51 return new CompressionHandler(ZlibCompressor.newFactory(dictionary));
52 }
53
54 public static ChannelHandler newZlibEncoder(int compressionLevel, byte[] dictionary) {
55 return new CompressionHandler(ZlibCompressor.newFactory(compressionLevel, dictionary));
56 }
57
58 public static ChannelHandler newZlibEncoder(int compressionLevel, int windowBits, int memLevel, byte[] dictionary) {
59 return new CompressionHandler(ZlibCompressor.newFactory(compressionLevel, dictionary));
60 }
61
62 public static ChannelHandler newZlibDecoder() {
63 return new DecompressionHandler(ZlibDecompressor.newFactory(true));
64 }
65
66 public static ChannelHandler newZlibDecoder(ZlibWrapper wrapper) {
67 return new DecompressionHandler(ZlibDecompressor.newFactory(wrapper, true));
68 }
69
70 public static ChannelHandler newZlibDecoder(byte[] dictionary) {
71 return new DecompressionHandler(ZlibDecompressor.newFactory(dictionary));
72 }
73
74 private ZlibCodecFactory() {
75
76 }
77 }