BZip2

Select bzip2 with Compression.bzip2(); Decompressor detects it from its magic number.

Options: blockSize (1 to 9, in units of 100 KB; default 9) and decompressConcatenated.

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

Example Usage

Bzip2 Compression
try (Compressor compressor = Compressor.builder(
                Path.of("example.bz2"), Compression.bzip2().blockSize(5))
        .build()) {
    compressor.write(Path.of("path/to/file.txt"));
}
Bzip2 Decompression
try (Decompressor decompressor =
        Decompressor.builder(Path.of("example.bz2")).build()) {
    decompressor.write(Path.of("path/to/file.txt"));
}