mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-04-19 03:01:48 +08:00
CompressUtil automatically decompress tgz and tar.gz files
This commit is contained in:
parent
2384ea0425
commit
cc69792280
@ -183,6 +183,11 @@ public class CompressUtil {
|
|||||||
return new SevenZExtractor(file);
|
return new SevenZExtractor(file);
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
if (StrUtil.isBlank(archiverName) && file.getName().toLowerCase().endsWith(".tgz")) {
|
||||||
|
archiverName = "tgz";
|
||||||
|
} else if (StrUtil.isBlank(archiverName) && file.getName().toLowerCase().endsWith(".tar.gz")) {
|
||||||
|
archiverName = "tar.gz";
|
||||||
|
}
|
||||||
return new StreamExtractor(charset, archiverName, file);
|
return new StreamExtractor(charset, archiverName, file);
|
||||||
} catch (final CompressException e) {
|
} catch (final CompressException e) {
|
||||||
final Throwable cause = e.getCause();
|
final Throwable cause = e.getCause();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user