gpt4 book ai didi

org.jboss.as.patching.ZipUtils.unzip()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-19 21:43:31 26 4
gpt4 key购买 nike

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

ZipUtils.unzip介绍

[英]unpack...
[中]

代码示例

代码示例来源:origin: wildfly/wildfly-core

/**
 * unpack...
 *
 * @param zip the zip
 * @param patchDir the patch dir
 * @throws IOException
 */
public static void unzip(final File zip, final File patchDir) throws IOException {
  try (final ZipFile zipFile = new ZipFile(zip)){
    unzip(zipFile, patchDir);
  }
}

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

/**
 * unpack...
 *
 * @param zip the zip
 * @param patchDir the patch dir
 * @throws IOException
 */
public static void unzip(final File zip, final File patchDir) throws IOException {
  try (final ZipFile zipFile = new ZipFile(zip)){
    unzip(zipFile, patchDir);
  }
}

代码示例来源:origin: wildfly/wildfly-core

private static File expandContent(File patchFile, final File workDir, final String expandDirName) throws PatchingException {
  final File patchDir;
  try {
    if (!patchFile.isDirectory()) {
      patchDir = new File(workDir, expandDirName);
      // Save the content
      final File cachedContent = new File(patchDir, "content");
      IoUtils.copy(patchFile, cachedContent);
      // Unpack to the work dir
      ZipUtils.unzip(cachedContent, patchDir);
    } else {
      patchDir = patchFile;
    }
  } catch (IOException e) {
    throw new PatchingException("Failed to unzip " + patchFile.getAbsolutePath());
  }
  return patchDir;
}

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

private static File expandContent(File patchFile, final File workDir, final String expandDirName) throws PatchingException {
  final File patchDir;
  try {
    if (!patchFile.isDirectory()) {
      patchDir = new File(workDir, expandDirName);
      // Save the content
      final File cachedContent = new File(patchDir, "content");
      IoUtils.copy(patchFile, cachedContent);
      // Unpack to the work dir
      ZipUtils.unzip(cachedContent, patchDir);
    } else {
      patchDir = patchFile;
    }
  } catch (IOException e) {
    throw new PatchingException("Failed to unzip " + patchFile.getAbsolutePath());
  }
  return patchDir;
}

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

private PatchingResult applyPatch(final File parentWorkDir, final InputStream is, final ContentVerificationPolicy contentPolicy) throws PatchingException {
  File workDir = null;
  try {
    // Create a working dir
    workDir = parentWorkDir == null ? IdentityPatchRunner.createTempDir() : IdentityPatchRunner.createTempDir(parentWorkDir);
    try {
      // Save the content
      Path cachedContent = workDir.toPath().resolve("content");
      Files.copy(is, cachedContent);
      // Unpack to the work dir
      ZipUtils.unzip(cachedContent.toFile(), workDir);
    } catch (IOException e) {
      throw PatchLogger.ROOT_LOGGER.cannotCopyFilesToTempDir(workDir.getAbsolutePath(), e.getMessage(), e); // add info that temp dir is involved
    }
    // Execute
    return execute(workDir, contentPolicy);
  } catch (Exception e) {
    throw rethrowException(e);
  } finally {
    if (workDir != null && !IoUtils.recursiveDelete(workDir)) {
      PatchLogger.ROOT_LOGGER.cannotDeleteFile(workDir.getAbsolutePath());
    }
  }
}

代码示例来源:origin: wildfly/wildfly-core

private PatchingResult applyPatch(final File parentWorkDir, final InputStream is, final ContentVerificationPolicy contentPolicy) throws PatchingException {
  File workDir = null;
  try {
    // Create a working dir
    workDir = parentWorkDir == null ? IdentityPatchRunner.createTempDir() : IdentityPatchRunner.createTempDir(parentWorkDir);
    try {
      // Save the content
      Path cachedContent = workDir.toPath().resolve("content");
      Files.copy(is, cachedContent);
      // Unpack to the work dir
      ZipUtils.unzip(cachedContent.toFile(), workDir);
    } catch (IOException e) {
      throw PatchLogger.ROOT_LOGGER.cannotCopyFilesToTempDir(workDir.getAbsolutePath(), e.getMessage(), e); // add info that temp dir is involved
    }
    // Execute
    return execute(workDir, contentPolicy);
  } catch (Exception e) {
    throw rethrowException(e);
  } finally {
    if (workDir != null && !IoUtils.recursiveDelete(workDir)) {
      PatchLogger.ROOT_LOGGER.cannotDeleteFile(workDir.getAbsolutePath());
    }
  }
}

代码示例来源:origin: org.jboss.as/patch-gen

if (existing != null && existing.exists()) {
  ZipUtils.unzip(existing, multiPatchContent);
for (final File patch : patches) {
  final File patchContent = new File(tmp, "patch-content-" + i);
  ZipUtils.unzip(patch, patchContent);

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