Zstandard

Select Zstandard with Compression.zstd(); Decompressor detects it from its magic number. It requires com.github.luben:zstd-jni at runtime; see Additional Formats.

The one option, level, defaults to 3.

Decompressor enforces the default limits; a stream that expands past a ratio of 100 after the first MiB throws LimitExceededException.

Example Usage

Zstandard Compression
try (Compressor compressor = Compressor.builder(
                Path.of("example.zst"), Compression.zstd().level(6))
        .build()) {
    compressor.write(Path.of("path/to/file.txt"));
}
Zstandard Decompression
try (Decompressor decompressor =
        Decompressor.builder(Path.of("example.zst")).build()) {
    decompressor.write(Path.of("path/to/file.txt"));
}