MCPcopy Index your code
hub / github.com/apache/orc / ZlibOptions

Class ZlibOptions

java/core/src/java/org/apache/orc/impl/ZlibCodec.java:36–111  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

34 private Boolean direct = null;
35
36 static class ZlibOptions implements Options {
37 private int level;
38 private int strategy;
39 private final boolean FIXED;
40
41 ZlibOptions(int level, int strategy, boolean fixed) {
42 this.level = level;
43 this.strategy = strategy;
44 FIXED = fixed;
45 }
46
47 @Override
48 public ZlibOptions copy() {
49 return new ZlibOptions(level, strategy, false);
50 }
51
52 @Override
53 public ZlibOptions setSpeed(SpeedModifier newValue) {
54 if (FIXED) {
55 throw new IllegalStateException("Attempt to modify the default options");
56 }
57 switch (newValue) {
58 case FAST:
59 // deflate_fast looking for 16 byte patterns
60 level = Deflater.BEST_SPEED + 1;
61 break;
62 case DEFAULT:
63 // deflate_slow looking for 128 byte patterns
64 level = Deflater.DEFAULT_COMPRESSION;
65 break;
66 case FASTEST:
67 // deflate_fast looking for 8 byte patterns
68 level = Deflater.BEST_SPEED;
69 break;
70 default:
71 break;
72 }
73 return this;
74 }
75
76 @Override
77 public ZlibOptions setData(DataKind newValue) {
78 if (FIXED) {
79 throw new IllegalStateException("Attempt to modify the default options");
80 }
81 switch (newValue) {
82 case BINARY:
83 /* filtered == less LZ77, more huffman */
84 strategy = Deflater.FILTERED;
85 break;
86 case TEXT:
87 strategy = Deflater.DEFAULT_STRATEGY;
88 break;
89 default:
90 break;
91 }
92 return this;
93 }

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected