Class ZstdUtils
- java.lang.Object
-
- org.apache.commons.compress.compressors.zstandard.ZstdUtils
-
public class ZstdUtils extends java.lang.Object
Utility code for the Zstandard compression format.This class avoids making the underlying
zstdclasses part of the public or protected API. The underlying implementation is provided through the Zstandard JNI library which is based on zstd.- Since:
- 1.16
- See Also:
- Zstandard JNI, zstd
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static booleanisZstdCompressionAvailable()Are the classes required to support Zstandard compression available?static booleanmatches(byte[] signature, int length)Checks if the signature matches what is expected for a Zstandard file.static voidsetCacheZstdAvailablity(boolean doCache)Sets whether to cache the result of the Zstandard for Java check.
-
-
-
Method Detail
-
isZstdCompressionAvailable
public static boolean isZstdCompressionAvailable()
Are the classes required to support Zstandard compression available?- Returns:
- true if the classes required to support Zstandard compression are available
-
matches
public static boolean matches(byte[] signature, int length)
Checks if the signature matches what is expected for a Zstandard file.- Parameters:
signature- the bytes to checklength- the number of bytes to check- Returns:
- true if signature matches the Ztstandard or skippable frame magic bytes, false otherwise
-
setCacheZstdAvailablity
public static void setCacheZstdAvailablity(boolean doCache)
Sets whether to cache the result of the Zstandard for Java check.This defaults to
falsein an OSGi environment andtrueotherwise.- Parameters:
doCache- whether to cache the result
-
-