Extract .gz files in java

Ray*_*ark 5 java gzip unzip

I'm trying to unzip some .gz files in java. After some researches i wrote this method:

    public static void gunzipIt(String name){

    byte[] buffer = new byte[1024];

    try{

        GZIPInputStream gzis = new GZIPInputStream(new FileInputStream("/var/www/html/grepobot/API/"+ name + ".txt.gz"));
        FileOutputStream out = new FileOutputStream("/var/www/html/grepobot/API/"+ name + ".txt");

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

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

        System.out.println("Extracted " + name);

    } catch(IOException ex){
        ex.printStackTrace();
    }
}
Run Code Online (Sandbox Code Playgroud)

when i try to execute it i get this error: java.util.zip.ZipException: Not in GZIP format

how can i solve it? Thanks in advance for your help

Cag*_*men -3

import com.horsefly.utils.GZIP;
import org.apache.commons.io.FileUtils;
....
String content = new String(new GZIP().decompresGzipToBytes(FileUtils.readFileToByteArray(fileName)), "UTF-8");
Run Code Online (Sandbox Code Playgroud)

以防有人需要。