Here you can find the source of decompressFile(String inName)
public static void decompressFile(String inName)
//package com.java2s; //License from project: Apache License import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.util.zip.GZIPInputStream; public class Main { private static Integer BUFF_SIZE = 1024; public static void decompressFile(String inName) { try {/* w w w . j a v a2 s . c o m*/ File f = new File(inName); String outName = inName.replace(".gz", ""); File fout = new File(outName); if (fout.exists()) { System.out.println("Unzip File Already Exist:" + outName); System.out.println("Rename:" + outName + "(1)"); fout = new File(outName + "(1)"); } FileInputStream is = new FileInputStream(f); FileOutputStream os = new FileOutputStream(fout); GZIPInputStream gs = new GZIPInputStream(is); int len; byte buf[] = new byte[BUFF_SIZE]; while ((len = gs.read(buf, 0, BUFF_SIZE)) != -1) { os.write(buf, 0, len); } is.close(); os.close(); gs.close(); } catch (Exception e) { System.out.println(e); } } }