byte[] buffer = new byte[1024 * 1024];
int len = fis.read(buffer);
byte[] cmp = new byte[len];
System.arraycopy(buffer, 0, cmp, 0, len);
JFastLZ fastlz = new JFastLZ();
byte[] newbuf = new byte[len];
long start = System.currentTimeMillis();
for (int i = 0; i < loopcount; i++)
{
int newlen = fastlz.fastlzCompress(JFastLZLevel.One, cmp, 0,
cmp.length, newbuf, 0, newbuf.length);
}
long end = System.currentTimeMillis();
int newlen = fastlz.fastlzCompress(JFastLZLevel.One, cmp, 0,
cmp.length, newbuf, 0, newbuf.length);
System.out.println("FastLZ Compressed size:" + newlen
+ " for uncompressed size:" + len + ", cost " + (end - start)
+ "ms");
start = System.currentTimeMillis();
for (int i = 0; i < loopcount; i++)
{
int newlen2 = fastlz.fastlzDecompress(newbuf, 0, newlen, buffer, 0,
buffer.length);
}
end = System.currentTimeMillis();
int newlen2 = fastlz.fastlzDecompress(newbuf, 0, newlen, buffer, 0,
buffer.length);
byte[] resume = new byte[newlen2];
System.arraycopy(buffer, 0, resume, 0, newlen2);
System.out.println("FastLZ Decompress cost " + (end - start) + "ms");
assertArrayEquals(cmp, resume);