001/*
002 * Licensed to the Apache Software Foundation (ASF) under one
003 * or more contributor license agreements.  See the NOTICE file
004 * distributed with this work for additional information
005 * regarding copyright ownership.  The ASF licenses this file
006 * to you under the Apache License, Version 2.0 (the
007 * "License"); you may not use this file except in compliance
008 * with the License.  You may obtain a copy of the License at
009 *
010 *   https://www.apache.org/licenses/LICENSE-2.0
011 *
012 * Unless required by applicable law or agreed to in writing,
013 * software distributed under the License is distributed on an
014 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015 * KIND, either express or implied.  See the License for the
016 * specific language governing permissions and limitations
017 * under the License.
018 */
019
020package org.apache.commons.compress.compressors.zstandard;
021
022import com.github.luben.zstd.Zstd;
023
024/**
025 * Zstd constants.
026 *
027 * @since 1.28.0
028 */
029public class ZstdConstants {
030
031    /**
032     * Maximum chain log value.
033     *
034     * <p>
035     * <small>This constant name matches the name in the C header file.</small>
036     * </p>
037     *
038     * @see ZstdCompressorOutputStream.Builder#setLevel(int)
039     * @see <a href="https://github.com/facebook/zstd/blob/dev/lib/zstd.h">zstd.h</a>
040     */
041    public static final int ZSTD_CHAINLOG_MAX = Zstd.chainLogMax();
042
043    /**
044     * Minimum chain log value.
045     *
046     * <p>
047     * <small>This constant name matches the name in the C header file.</small>
048     * </p>
049     *
050     * @see ZstdCompressorOutputStream.Builder#setLevel(int)
051     * @see <a href="https://github.com/facebook/zstd/blob/dev/lib/zstd.h">zstd.h</a>
052     */
053    public static final int ZSTD_CHAINLOG_MIN = Zstd.chainLogMin();
054
055    /**
056     * Default compression level.
057     *
058     * <p>
059     * <small>This constant name matches the name in the C header file.</small>
060     * </p>
061     *
062     * @see ZstdCompressorOutputStream.Builder#setLevel(int)
063     * @see <a href="https://github.com/facebook/zstd/blob/dev/lib/zstd.h">zstd.h</a>
064     */
065    public static final int ZSTD_CLEVEL_DEFAULT = Zstd.defaultCompressionLevel();
066
067    /**
068     * Maximum compression level.
069     *
070     * <p>
071     * <small>This constant name matches the name in the C header file.</small>
072     * </p>
073     *
074     * @see ZstdCompressorOutputStream.Builder#setLevel(int)
075     * @see <a href="https://github.com/facebook/zstd/blob/dev/lib/zstd.h">zstd.h</a>
076     */
077    public static final int ZSTD_CLEVEL_MAX = Zstd.maxCompressionLevel();
078
079    /**
080     * Minimum compression level.
081     *
082     * <p>
083     * <small>This constant name matches the name in the C header file.</small>
084     * </p>
085     *
086     * @see ZstdCompressorOutputStream.Builder#setLevel(int)
087     * @see <a href="https://github.com/facebook/zstd/blob/dev/lib/zstd.h">zstd.h</a>
088     */
089    public static final int ZSTD_CLEVEL_MIN = Zstd.minCompressionLevel();
090
091    /**
092     * Maximum hash log value.
093     *
094     * <p>
095     * <small>This constant name matches the name in the C header file.</small>
096     * </p>
097     *
098     * @see ZstdCompressorOutputStream.Builder#setHashLog(int)
099     * @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}