import java.io.*;

/**
Performance comparison zip-decompression between the
native implementation with zlib and the pure Java implementation
from net.sf.jazzlib.
I got native around 2.5 faster than pure Java (jazzlib-0.06).

Author: Peter Büttner www.peterbuettner.de

*/

public class GzipPerf{

	static final String fileName="D:\\Doku\\Java\\jdk1.4.1\\src.tar.gz"; your file here
	static final int bufferSizeGZip = 0x4000;


static void test(InputStream is)throws Exception {
	byte[] readBuffer = new byte[0x4000];
	int len =0;
	int size=0;
	long t0=System.currentTimeMillis();
	while ( (len=is.read(readBuffer)) !=-1)size +=len;
	long t1=System.currentTimeMillis();
	System.out.println(is.getClass().getPackage().getName()  + " size: " + size + "  time: " + (t1-t0));
	}


public static void main(String [] args)throws Exception {
	FileInputStream fis;

	fis = new FileInputStream(fileName);
	test(new java.util.zip.GZIPInputStream(fis, bufferSizeGZip));
	fis.close();

	fis = new FileInputStream(fileName);
	test(new net.sf.jazzlib.GZIPInputStream(fis, bufferSizeGZip));
	fis.close();

	}
}