1 /* 2 * Licensed to the Apache Software Foundation (ASF) under one 3 * or more contributor license agreements. See the NOTICE file 4 * distributed with this work for additional information 5 * regarding copyright ownership. The ASF licenses this file 6 * to you under the Apache License, Version 2.0 (the 7 * "License"); you may not use this file except in compliance 8 * with the License. You may obtain a copy of the License at 9 * 10 * https://www.apache.org/licenses/LICENSE-2.0 11 * 12 * Unless required by applicable law or agreed to in writing, 13 * software distributed under the License is distributed on an 14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 * KIND, either express or implied. See the License for the 16 * specific language governing permissions and limitations 17 * under the License. 18 */ 19 20 package org.apache.commons.compress.compressors.zstandard; 21 22 import com.github.luben.zstd.Zstd; 23 24 /** 25 * Zstd constants. 26 * 27 * @since 1.28.0 28 */ 29 public class ZstdConstants { 30 31 /** 32 * Maximum chain log value. 33 * 34 * <p> 35 * <small>This constant name matches the name in the C header file.</small> 36 * </p> 37 * 38 * @see ZstdCompressorOutputStream.Builder#setLevel(int) 39 * @see <a href="https://github.com/facebook/zstd/blob/dev/lib/zstd.h">zstd.h</a> 40 */ 41 public static final int ZSTD_CHAINLOG_MAX = Zstd.chainLogMax(); 42 43 /** 44 * Minimum chain log value. 45 * 46 * <p> 47 * <small>This constant name matches the name in the C header file.</small> 48 * </p> 49 * 50 * @see ZstdCompressorOutputStream.Builder#setLevel(int) 51 * @see <a href="https://github.com/facebook/zstd/blob/dev/lib/zstd.h">zstd.h</a> 52 */ 53 public static final int ZSTD_CHAINLOG_MIN = Zstd.chainLogMin(); 54 55 /** 56 * Default compression level. 57 * 58 * <p> 59 * <small>This constant name matches the name in the C header file.</small> 60 * </p> 61 * 62 * @see ZstdCompressorOutputStream.Builder#setLevel(int) 63 * @see <a href="https://github.com/facebook/zstd/blob/dev/lib/zstd.h">zstd.h</a> 64 */ 65 public static final int ZSTD_CLEVEL_DEFAULT = Zstd.defaultCompressionLevel(); 66 67 /** 68 * Maximum compression level. 69 * 70 * <p> 71 * <small>This constant name matches the name in the C header file.</small> 72 * </p> 73 * 74 * @see ZstdCompressorOutputStream.Builder#setLevel(int) 75 * @see <a href="https://github.com/facebook/zstd/blob/dev/lib/zstd.h">zstd.h</a> 76 */ 77 public static final int ZSTD_CLEVEL_MAX = Zstd.maxCompressionLevel(); 78 79 /** 80 * Minimum compression level. 81 * 82 * <p> 83 * <small>This constant name matches the name in the C header file.</small> 84 * </p> 85 * 86 * @see ZstdCompressorOutputStream.Builder#setLevel(int) 87 * @see <a href="https://github.com/facebook/zstd/blob/dev/lib/zstd.h">zstd.h</a> 88 */ 89 public static final int ZSTD_CLEVEL_MIN = Zstd.minCompressionLevel(); 90 91 /** 92 * Maximum hash log value. 93 * 94 * <p> 95 * <small>This constant name matches the name in the C header file.</small> 96 * </p> 97 * 98 * @see ZstdCompressorOutputStream.Builder#setHashLog(int) 99 * @see <a href="https://github.com/facebook/zstd/blob/dev/lib/zstd.h">zstd.h</a> 100 */ 101 public static final int ZSTD_HASHLOG_MAX = Zstd.hashLogMax(); 102 103 /** 104 * Minimum hash log value. 105 * 106 * <p> 107 * <small>This constant name matches the name in the C header file.</small> 108 * </p> 109 * 110 * @see ZstdCompressorOutputStream.Builder#setHashLog(int) 111 * @see <a href="https://github.com/facebook/zstd/blob/dev/lib/zstd.h">zstd.h</a> 112 */ 113 public static final int ZSTD_HASHLOG_MIN = Zstd.hashLogMin(); 114 115 /** 116 * {@code ZSTD_MINMATCH_MAX} = {@value}. Only for ZSTD_fast, other strategies are limited to 6. 117 * 118 * <p> 119 * <small>This constant name matches the name in the C header file.</small> 120 * </p> 121 * 122 * @see ZstdCompressorOutputStream.Builder#setMinMatch(int) 123 * @see <a href="https://github.com/facebook/zstd/blob/dev/lib/zstd.h">zstd.h</a> 124 */ 125 public static final int ZSTD_MINMATCH_MAX = 7; 126 127 /** 128 * {@code ZSTD_MINMATCH_MAX} = {@value}. Only for ZSTD_btopt+, faster strategies are limited to 4. 129 */ 130 public static final int ZSTD_MINMATCH_MIN = 3; 131 132 /** 133 * Maximum search log value. 134 * 135 * <p> 136 * <small>This constant name matches the name in the C header file.</small> 137 * </p> 138 * 139 * @see ZstdCompressorOutputStream.Builder#setSearchLog(int) 140 * @see <a href="https://github.com/facebook/zstd/blob/dev/lib/zstd.h">zstd.h</a> 141 */ 142 public static final int ZSTD_SEARCHLOG_MAX = Zstd.searchLogMax(); 143 144 /** 145 * Minimum search log value. 146 * 147 * <p> 148 * <small>This constant name matches the name in the C header file.</small> 149 * </p> 150 * 151 * @see ZstdCompressorOutputStream.Builder#setSearchLog(int) 152 * @see <a href="https://github.com/facebook/zstd/blob/dev/lib/zstd.h">zstd.h</a> 153 */ 154 public static final int ZSTD_SEARCHLOG_MIN = Zstd.searchLogMin(); 155 156 /** 157 * {@code ZSTD_WINDOWLOG_LIMIT_DEFAULT} = {@value}. 158 * <p> 159 * By default, the streaming decoder will refuse any frame requiring larger than (in C) {@code (1 << ZSTD_WINDOWLOG_LIMIT_DEFAULT)} window size, to preserve 160 * host's memory from unreasonable requirements. 161 * </p> 162 * 163 * <p> 164 * <small>This constant name matches the name in the C header file.</small> 165 * </p> 166 * 167 * @see ZstdCompressorOutputStream.Builder#setMinMatch(int) 168 * @see <a href="https://github.com/facebook/zstd/blob/dev/lib/zstd.h">zstd.h</a> 169 */ 170 public static final int ZSTD_WINDOWLOG_LIMIT_DEFAULT = 27; 171 172 /** 173 * Maximum window log value. 174 * 175 * <p> 176 * <small>This constant name matches the name in the C header file.</small> 177 * </p> 178 * 179 * @see ZstdCompressorOutputStream.Builder#setWindowLog(int) 180 * @see <a href="https://github.com/facebook/zstd/blob/dev/lib/zstd.h">zstd.h</a> 181 */ 182 public static final int ZSTD_WINDOWLOG_MAX = Zstd.windowLogMax(); 183 184 /** 185 * Minimum window log value. 186 * 187 * <p> 188 * <small>This constant name matches the name in the C header file.</small> 189 * </p> 190 * 191 * @see ZstdCompressorOutputStream.Builder#setWindowLog(int) 192 * @see <a href="https://github.com/facebook/zstd/blob/dev/lib/zstd.h">zstd.h</a> 193 */ 194 public static final int ZSTD_WINDOWLOG_MIN = Zstd.windowLogMin(); 195 196 }