Enum Class CompressionAlgorithm
java.lang.Object
java.lang.Enum<CompressionAlgorithm>
io.fluxzero.common.serialization.compression.CompressionAlgorithm
- All Implemented Interfaces:
Serializable, Comparable<CompressionAlgorithm>, Constable
Enumeration of supported compression algorithms used for serializing and deserializing byte data.
The available algorithms include:
NONE– No compression. The input is passed through unchanged.LZ4– Fast compression using the LZ4 codec. Optimized for speed and suitable for large volumes of data.ZSTD– Zstandard compression. Optimized for fast transport compression at high throughput.GZIP– Standard GZIP compression. Compatible with most zip tools and libraries.
-
Nested Class Summary
Nested classes/interfaces inherited from class Enum
Enum.EnumDesc<E> -
Enum Constant Summary
Enum Constants -
Method Summary
Modifier and TypeMethodDescriptionabstract byte[]compress(byte[] uncompressed) Compresses bytes using this algorithm's public SDK wire format.abstract byte[]decompress(byte[] compressed) Decompresses bytes using this algorithm's public SDK wire format.static CompressionAlgorithmReturns the enum constant of this class with the specified name.static CompressionAlgorithm[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
NONE
No compression. Data is stored and retrieved as-is. -
LZ4
Fast compression using the LZ4 codec. Includes original size prefix in output. -
ZSTD
Zstandard compression using the Fluxzero compression header format. -
GZIP
GZIP compression using standard Java APIs. Produces .gz-compatible output.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-
compress
public abstract byte[] compress(byte[] uncompressed) Compresses bytes using this algorithm's public SDK wire format.LZ4 preserves the legacy 4-byte size prefix format. ZSTD uses the Fluxzero compression header so the decoder can identify the payload algorithm. GZIP keeps the standard gzip stream format.
- Parameters:
uncompressed- bytes to compress- Returns:
- compressed bytes
-
decompress
public abstract byte[] decompress(byte[] compressed) Decompresses bytes using this algorithm's public SDK wire format.- Parameters:
compressed- bytes to decompress- Returns:
- decompressed bytes
-