Top Description Inners Fields Constructors Methods
org.apache.commons.compress.compressors.zstandard

public Class ZstdUtils

extends Object
Class Inheritance
Imports
org.apache.commons.compress.utils.OsgiUtils

Utility code for the Zstandard compression format.
Since
1.16

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static enum

Field Summary

Modifier and TypeField and Description
private static volatile ZstdUtils.CachedAvailability
private static final byte[]
SKIPPABLE_FRAME_MAGIC

Skippable Frame Magic Bytes - the three common bytes.

private static final byte[]
ZSTANDARD_FRAME_MAGIC

Zstandard Frame Magic Bytes.

Constructor Summary

AccessConstructor and Description
private
ZstdUtils()

Private constructor to prevent instantiation of this utility class.

Method Summary

Modifier and TypeMethod and Description
pack-priv static ZstdUtils.CachedAvailability
private static boolean
public static boolean

Returns:

true if the classes required to support Zstandard compression are available
isZstdCompressionAvailable
()

Are the classes required to support Zstandard compression available?

public static boolean

Returns:

true if signature matches the Ztstandard or skippable frame magic bytes, false otherwise
matches
(final byte[]
the bytes to check
signature
,
final int
the number of bytes to check
length
)

Checks if the signature matches what is expected for a Zstandard file.

public static void
setCacheZstdAvailablity(final boolean
whether to cache the result
doCache
)

Whether to cache the result of the Zstandard for Java check.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

cachedZstdAvailabilityback to summary
private static volatile ZstdUtils.CachedAvailability cachedZstdAvailability
SKIPPABLE_FRAME_MAGICback to summary
private static final byte[] SKIPPABLE_FRAME_MAGIC

Skippable Frame Magic Bytes - the three common bytes.

ZSTANDARD_FRAME_MAGICback to summary
private static final byte[] ZSTANDARD_FRAME_MAGIC

Zstandard Frame Magic Bytes.

Constructor Detail

ZstdUtilsback to summary
private ZstdUtils()

Private constructor to prevent instantiation of this utility class.

Method Detail

getCachedZstdAvailabilityback to summary
pack-priv static ZstdUtils.CachedAvailability getCachedZstdAvailability()
internalIsZstdCompressionAvailableback to summary
private static boolean internalIsZstdCompressionAvailable()
isZstdCompressionAvailableback to summary
public static boolean isZstdCompressionAvailable()

Are the classes required to support Zstandard compression available?

Returns:boolean

true if the classes required to support Zstandard compression are available

matchesback to summary
public static boolean matches(final byte[] signature, final int length)

Checks if the signature matches what is expected for a Zstandard file.

Parameters
signature:byte[]

the bytes to check

length:int

the number of bytes to check

Returns:boolean

true if signature matches the Ztstandard or skippable frame magic bytes, false otherwise

setCacheZstdAvailablityback to summary
public static void setCacheZstdAvailablity(final boolean doCache)

Whether to cache the result of the Zstandard for Java check.

This defaults to false in an OSGi environment and true otherwise.

Parameters
doCache:boolean

whether to cache the result

org.apache.commons.compress.compressors.zstandard back to summary

pack-priv final Enum ZstdUtils.CachedAvailability

extends Enum<ZstdUtils.CachedAvailability>
Class Inheritance

Field Summary

Modifier and TypeField and Description
public static final ZstdUtils.CachedAvailability
public static final ZstdUtils.CachedAvailability
public static final ZstdUtils.CachedAvailability

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static ZstdUtils.CachedAvailability
public static ZstdUtils.CachedAvailability[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

CACHED_AVAILABLEback to summary
public static final ZstdUtils.CachedAvailability CACHED_AVAILABLE
CACHED_UNAVAILABLEback to summary
public static final ZstdUtils.CachedAvailability CACHED_UNAVAILABLE
DONT_CACHEback to summary
public static final ZstdUtils.CachedAvailability DONT_CACHE

Constructor Detail

CachedAvailabilityback to summary
private CachedAvailability()

Method Detail

valueOfback to summary
public static ZstdUtils.CachedAvailability valueOf(String name)
valuesback to summary
public static ZstdUtils.CachedAvailability[] values()