gpt4 book ai didi

jodd.io.ZipUtil.unzip()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-13 23:22:03 26 4
gpt4 key购买 nike

本文整理了Java中jodd.io.ZipUtil.unzip()方法的一些代码示例,展示了ZipUtil.unzip()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZipUtil.unzip()方法的具体详情如下:
包路径:jodd.io.ZipUtil
类名称:ZipUtil
方法名:unzip

ZipUtil.unzip介绍

[英]Extracts zip file to the target directory. If patterns are provided only matched paths are extracted.
[中]将zip文件提取到目标目录。如果提供了模式,则只提取匹配的路径。

代码示例

代码示例来源:origin: redisson/redisson

/**
 * Extracts zip file content to the target directory.
 * @see #unzip(java.io.File, java.io.File, String...)
 */
public static void unzip(String zipFile, String destDir, String... patterns) throws IOException {
  unzip(new File(zipFile), new File(destDir), patterns);
}

代码示例来源:origin: oblac/jodd

/**
 * Extracts zip file content to the target directory.
 * @see #unzip(java.io.File, java.io.File, String...)
 */
public static void unzip(final String zipFile, final String destDir, final String... patterns) throws IOException {
  unzip(new File(zipFile), new File(destDir), patterns);
}

代码示例来源:origin: oblac/jodd

@Test
void testZipBuilderFile() throws IOException {
  File zipFile = new File(dataRoot, "test.zip");
  ZipBuilder.createZipFile(zipFile)
    .add(new File(dataRoot, "sb.data"))
      .path("sbdata").comment("This is sb data file").save()
    .add(new File(dataRoot, "file"))
      .path("folder").comment("This is a folder and all its files").save()
    .toZipFile();
  assertTrue(zipFile.exists());
  ZipUtil.unzip(zipFile, new File(dataRoot), "sbda*");
  assertTrue(new File(dataRoot, "sbdata").exists());
  assertFalse(new File(dataRoot, "folder").exists());
  ZipUtil.unzip(zipFile, new File(dataRoot));
  assertTrue(new File(dataRoot, "sbdata").exists());
  assertTrue(new File(dataRoot, "folder").exists());
  assertTrue(new File(new File(dataRoot, "folder"), "a.png").exists());
  // cleanup
  FileUtil.delete(new File(dataRoot, "sbdata"));
  FileUtil.deleteDir(new File(dataRoot, "folder"));
  FileUtil.delete(zipFile);
}

代码示例来源:origin: oblac/jodd

ZipUtil.unzip(zipFile, new File(dataRoot));

代码示例来源:origin: org.jodd/jodd-core

/**
 * Extracts zip file content to the target directory.
 * @see #unzip(java.io.File, java.io.File, String...)
 */
public static void unzip(final String zipFile, final String destDir, final String... patterns) throws IOException {
  unzip(new File(zipFile), new File(destDir), patterns);
}

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com