Kenmegne
7 days ago 1bc8864f134272c4bf23a9b05831803a423a4771
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package com.megatim.apifdxweb.tools;
 
import com.megatim.module.compression.impl.JavaZipZip4Impl;
import java.io.File;
import java.nio.file.Paths;
 
/**
 *
 * @author lenovo
 */
public class AppFileUtils {
 
    private AppFileUtils() {
    }
 
    public static File unzipFileInDirectory(String source, String destination) throws Exception {
        File sourceFile = new File(source);
        File destinationFile = new File(destination);
 
        String sourceFileName = sourceFile.getName();
        int lastIndex = sourceFileName.lastIndexOf(".");
        String unzipFileName = sourceFileName.substring(0, lastIndex);
 
        JavaZipZip4Impl zip = new JavaZipZip4Impl();
        zip.unZipFile(sourceFile, destinationFile);
 
        return Paths.get(destination, unzipFileName).toFile();
    }
 
}