Java Gunzip File gunzip(String inFile, String outFile)

Here you can find the source of gunzip(String inFile, String outFile)

Description

gunzip

License

Open Source License

Declaration

public static void gunzip(String inFile, String outFile) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.zip.GZIPInputStream;

public class Main {
    public static void gunzip(String inFile, String outFile) {

        byte[] buffer = new byte[1024];

        try {/*w  w w .j a  va 2s . c o  m*/

            System.out.println("Gunzip...");

            GZIPInputStream gzis = new GZIPInputStream(new FileInputStream(inFile));

            FileOutputStream out = new FileOutputStream(outFile);

            int len;
            while ((len = gzis.read(buffer)) > 0) {
                out.write(buffer, 0, len);
            }

            gzis.close();
            out.close();

            System.out.println("Done");

        } catch (IOException ex) {
            ex.printStackTrace();
        }
    }
}

Related

  1. gunzip(File gzippedFile)
  2. gunzip(File gzippedFile, File destinationFile)
  3. gUnzip(File srcFile, File destFile)
  4. gunzip(InputStream packedData, OutputStream unpackedData)
  5. gunzip(String compressedStr)
  6. gunzipFile(File baseDir, File gzFile)
  7. gunzipFile(File file_input, File dir_output)
  8. gunzipFile(File inputGZippedFile, File outputFile)
  9. ungzip(byte[] bytes)