mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2026-03-10 00:13:40 +08:00
🎨 优化代码,重写jodd强制依赖的代码
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
package com.github.binarywang.wxpay.util;
|
||||
|
||||
import lombok.experimental.UtilityClass;
|
||||
import org.apache.commons.io.FilenameUtils;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.zip.GZIPInputStream;
|
||||
|
||||
/**
|
||||
* @author Binary Wang
|
||||
*/
|
||||
@UtilityClass
|
||||
public class ZipUtils {
|
||||
|
||||
/**
|
||||
* 解压gzip文件
|
||||
*/
|
||||
public static File unGzip(final File file) throws IOException {
|
||||
File resultFile = new File(FilenameUtils.removeExtension(file.getAbsolutePath()));
|
||||
resultFile.createNewFile();
|
||||
|
||||
try (FileOutputStream fos = new FileOutputStream(resultFile);
|
||||
GZIPInputStream gzis = new GZIPInputStream(new FileInputStream(file));) {
|
||||
IOUtils.copy(gzis, fos);
|
||||
}
|
||||
|
||||
return resultFile;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user