gpt4 book ai didi

org.molgenis.util.file.ZipFileUtil.unzip()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-18 02:17:31 29 4
gpt4 key购买 nike

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

ZipFileUtil.unzip介绍

[英]Unzips a zipfile into the directory it resides in.
[中]将zipfile解压到它所在的目录中。

代码示例

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

/**
 * Unzips a zipfile into the directory it resides in. Skips paths starting with '.' or '_'
 * (typically hidden paths).
 *
 * @param file the file to unzip
 * @return List of Files that got extracted
 * @throws UnzipException if something went wrong
 */
public static List<File> unzipSkipHidden(File file) {
 return unzip(file, name -> name.startsWith(".") || name.startsWith("_") ? null : name);
}

代码示例来源:origin: org.molgenis/molgenis-app-manager

@Override
public String uploadApp(InputStream zipData, String zipFileName, String formFieldName)
  throws IOException {
 String tempFilesDir = "extracted_" + zipFileName;
 String tempAppDirectoryName = APPS_TMP_DIR + separator + tempFilesDir;
 fileStore.createDirectory(tempAppDirectoryName);
 try {
  ZipFileUtil.unzip(zipData, fileStore.getFile(tempAppDirectoryName));
 } catch (UnzipException unzipException) {
  fileStore.delete(tempAppDirectoryName);
  throw new InvalidAppArchiveException(formFieldName, unzipException);
 }
 List<String> missingRequiredFilesList = buildMissingRequiredFiles(tempAppDirectoryName);
 if (!missingRequiredFilesList.isEmpty()) {
  fileStore.deleteDirectory(APPS_TMP_DIR);
  throw new AppArchiveMissingFilesException(missingRequiredFilesList);
 }
 return tempAppDirectoryName;
}

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