File fin = new File(args[0]);
File fout = new File(args[1]);
try {
FileInputStream fis = new FileInputStream(fin);
LZMAOutputStream compOut = new LZMAOutputStream(new BufferedOutputStream(new FileOutputStream(fout)), 4);
byte[] buffer = new byte[4096];
int c = 0;
while((c = fis.read(buffer)) != -1) {
compOut.write(buffer, 0, c);
}
fis.close();
compOut.close();
compOut = null;
Runtime.getRuntime().gc();
System.out.printf("Done. Input size %d compressed size %d\n", fin.length(), fout.length());