File test = new File("/dev/shm", fnonrand.getName() + ".lzma");
File fin = new File("/dev/shm", fnonrand.getName() + ".final");
long start = System.nanoTime();
FileOutputStream fos = new FileOutputStream(test);
FileInputStream fis = new FileInputStream(fnonrand);
LzmaOutputStream los = new LzmaOutputStream(fos, -1, new byte[4096], 1 << 22, 3, 0, 2, 1 << 0x20);
byte[] buffer = new byte[4096];
int len;
while (-1 != (len = fis.read(buffer, 0, buffer.length))) {
los.write(buffer, 0, len);
}
fis.close();
los.close();
long end = System.nanoTime();
System.out.println("" + ((double)(end - start) / 1000000000.0) + " seconds");
start = System.nanoTime();
fos = new FileOutputStream(fin);