in shardingsphere-benchmark/src/main/java/org/apache/shardingsphere/benchmark/common/file/util/FileUtil.java [100:122]
public static void decompressFile(String sourceFilePath, String destFilePath){
TarArchiveEntry entry;
File sourceFile = new File(sourceFilePath);
try {
TarArchiveInputStream fin = new TarArchiveInputStream(new GzipCompressorInputStream(new FileInputStream(sourceFile)));
File extraceFolder = new File(destFilePath);
while ((entry = fin.getNextTarEntry()) != null) {
if (entry.isDirectory()) {
continue;
}
File curfile = new File(extraceFolder, entry.getName());
File parent = curfile.getParentFile();
if (!parent.exists()) {
parent.mkdirs();
}
IOUtils.copy(fin, new FileOutputStream(curfile));
}
} catch (FileNotFoundException ex) {
ex.printStackTrace();
} catch (IOException ex) {
ex.printStackTrace();
}
}