You are viewing the documentation for a prerelease version.
View Latest
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"));
}
Want to help? Learn how to contribute to the Compress4J docs ›