BZip2
Here is a simple example of how to use bzip2 compression.
Example Usage
Bzip2 Compression
try (BZip2Compressor bzip2Compressor = BZip2Compressor.builder(Path.of("example.bz2"))
.compressorOutputStreamBuilder()
.blockSize(5)
.parentBuilder()
.build()) {
bzip2Compressor.write(Path.of("path/to/file.txt"));
}
Bzip2 Decompression
try (BZip2Decompressor gzipDecompressor =
BZip2Decompressor.builder(Path.of("example.bz2")).build()) {
gzipDecompressor.write(Path.of("path/to/file.txt"));
}