| Read-only: Compress4J can extract this format but cannot create it. |
Select it with Compression.unixZ(); Decompressor and the tar extractor detect it from its magic number. It needs no extra dependency and has no options.
The .Z format has no end marker, so a truncated file decompresses to a shorter output without an error. .tar.Z extraction fails when the truncation cuts a tar entry short. A cut that falls between entries reads as the end of the archive.
Decompressor enforces the default limits; a stream that expands past a ratio of 100 after the first MiB throws LimitExceededException.
Example Usage
Unix compress Decompression
try (Decompressor decompressor =
Decompressor.builder(Path.of("example.Z"), Compression.unixZ()).build()) {
decompressor.write(Path.of("path/to/file.txt"));
}
The tar extractor reads .tar.Z too; see tar.