Here you can find the source of unGzip(File inFile, File outFile)
Parameter | Description |
---|---|
inFile | a parameter |
outFile | a parameter |
Parameter | Description |
---|---|
FileNotFoundException | an exception |
IOException | an exception |
public static void unGzip(File inFile, File outFile) throws FileNotFoundException, IOException
//package com.java2s; //License from project: Open Source License import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.util.zip.GZIPInputStream; public class Main { /**//from w w w . ja v a2 s . c o m * Uncompresses a Gzipped file * @param inFile * @param outFile * @throws FileNotFoundException * @throws IOException */ public static void unGzip(File inFile, File outFile) throws FileNotFoundException, IOException { GZIPInputStream gIn = new GZIPInputStream(new FileInputStream(inFile)); FileOutputStream fos = new FileOutputStream(outFile); byte[] buffer = new byte[100000]; int len; while ((len = gIn.read(buffer)) > 0) { fos.write(buffer, 0, len); } gIn.close(); fos.close(); } }