mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
CompressUtil增加压缩和解压tgz(.tar.gz)文件
This commit is contained in:
@@ -10,6 +10,7 @@ import org.junit.Test;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
@SuppressWarnings("resource")
|
||||
public class ArchiverTest {
|
||||
|
||||
@Test
|
||||
@@ -53,7 +54,19 @@ public class ArchiverTest {
|
||||
public void sevenZTest(){
|
||||
final File file = FileUtil.file("d:/test/compress/test.7z");
|
||||
CompressUtil.createArchiver(CharsetUtil.CHARSET_UTF_8, ArchiveStreamFactory.SEVEN_Z, file)
|
||||
.add(FileUtil.file("d:/Java/apache-maven-3.6.3"), (f)->{
|
||||
.add(FileUtil.file("d:/Java/apache-maven-3.8.1"), (f)->{
|
||||
Console.log("Add: {}", f.getPath());
|
||||
return true;
|
||||
})
|
||||
.finish().close();
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void tgzTest(){
|
||||
final File file = FileUtil.file("d:/test/compress/test.tgz");
|
||||
CompressUtil.createArchiver(CharsetUtil.CHARSET_UTF_8, "tgz", file)
|
||||
.add(FileUtil.file("d:/Java/apache-maven-3.8.1"), (f)->{
|
||||
Console.log("Add: {}", f.getPath());
|
||||
return true;
|
||||
})
|
||||
|
@@ -27,4 +27,15 @@ public class ExtractorTest {
|
||||
|
||||
extractor.extract(FileUtil.file("d:/test/compress/test2/"));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void tgzTest(){
|
||||
Extractor extractor = CompressUtil.createExtractor(
|
||||
CharsetUtil.defaultCharset(),
|
||||
"tgz",
|
||||
FileUtil.file("d:/test/test.tgz"));
|
||||
|
||||
extractor.extract(FileUtil.file("d:/test/tgz/"));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user