Java
Java
bz2 Compress File
Compress a file to the bz2 file format.Chilkat Java Downloads
import com.chilkatsoft.*;
public class ChilkatExample {
static {
try {
System.loadLibrary("chilkat");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load.\n" + e);
System.exit(1);
}
}
public static void main(String argv[])
{
boolean success = false;
// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
CkBz2 bz2 = new CkBz2();
// Compress the file qa_data/hamlet.xml to create qa_output/hamlet.bz2
success = bz2.CompressFile("qa_data/hamlet.xml","qa_output/hamlet.bz2");
if (success != true) {
System.out.println(bz2.lastErrorText());
return;
}
System.out.println("Success.");
}
}