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

Class ZstdOptions

java/core/src/java/org/apache/orc/impl/ZstdCodec.java:58–160  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

56 }
57
58 static class ZstdOptions implements Options {
59 private int level;
60 private int windowLog;
61 private int strategy;
62
63 ZstdOptions(int level, int windowLog, int strategy) {
64 this.level = level;
65 this.windowLog = windowLog;
66 this.strategy = strategy;
67 }
68
69 @Override
70 public ZstdOptions copy() {
71 return new ZstdOptions(level, windowLog, strategy);
72 }
73
74 @Override
75 public Options setSpeed(SpeedModifier newValue) {
76 return this;
77 }
78
79 /**
80 * Sets the Zstandard long mode maximum back-reference distance, expressed
81 * as a power of 2.
82 * <p>
83 * The value must be between ZSTD_WINDOWLOG_MIN (10) and ZSTD_WINDOWLOG_MAX
84 * (30 and 31 on 32/64-bit architectures, respectively).
85 * <p>
86 * A value of 0 is a special value indicating to use the default
87 * ZSTD_WINDOWLOG_LIMIT_DEFAULT of 27, which corresponds to back-reference
88 * window size of 128MiB.
89 *
90 * @param newValue The desired power-of-2 value back-reference distance.
91 * @return ZstdOptions
92 */
93 public ZstdOptions setWindowLog(int newValue) {
94 if ((newValue < Zstd.windowLogMin() || newValue > Zstd.windowLogMax()) && newValue != 0) {
95 throw new IllegalArgumentException(
96 String.format(
97 "Zstd compression window size should be in the range %d to %d,"
98 + " or set to the default value of 0.",
99 Zstd.windowLogMin(),
100 Zstd.windowLogMax()));
101 }
102 windowLog = newValue;
103 return this;
104 }
105
106 /**
107 * Sets the Zstandard compression codec compression level directly using
108 * the integer setting. This value is typically between 0 and 22, with
109 * larger numbers indicating more aggressive compression and lower speed.
110 * <p>
111 * This method provides additional granularity beyond the setSpeed method
112 * so that users can select a specific level.
113 *
114 * @param newValue The level value of compression to set.
115 * @return ZstdOptions

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected