gpt4 book ai didi

com.atlassian.maven.plugins.amps.util.ZipUtils.unzip()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-13 12:28:14 28 4
gpt4 key购买 nike

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

ZipUtils.unzip介绍

[英]Unzips a file
[中]解开一个文件

代码示例

代码示例来源:origin: com.atlassian.maven.plugins/amps-maven-plugin

public static void unzip(File zipFile, String destDir) throws IOException
{
  unzip(zipFile, destDir, 0);
}

代码示例来源:origin: com.atlassian.maven.plugins/maven-amps-plugin

public static void unzip(final File zipFile, final String destDir) throws IOException
{
  unzip(zipFile, destDir, 0);
}

代码示例来源:origin: com.atlassian.maven.plugins/amps-maven-plugin

/**
 * Unzips a file
 *
 * @param zipFile
 *            the Zip file
 * @param destDir
 *            the destination folder
 * @param leadingPathSegmentsToTrim
 *            number of root folders to skip. Example: If all files are in generated-resources/home/*,
 *            then you may want to skip 2 folders.
 * @throws IOException if the archive cannot be expanded
 */
public static void unzip(File zipFile, String destDir, int leadingPathSegmentsToTrim) throws IOException
{
  unzip(zipFile, destDir, leadingPathSegmentsToTrim, false, null);
}

代码示例来源:origin: com.atlassian.maven.plugins/amps-maven-plugin

private void unpackServerArtifact(final File serverDistributionArtifactFile, final File serverDirectory) throws MojoExecutionException
{
  try
  {
    unzip(serverDistributionArtifactFile, serverDirectory.getPath(), 0);
  }
  catch (final IOException ex)
  {
    throw new MojoExecutionException("Unable to extract CTK server distribution: "  + serverDistributionArtifactFile, ex);
  }
}

代码示例来源:origin: com.atlassian.maven.plugins/maven-amps-plugin

private void unpackServerArtifact(final File serverDistributionArtifactFile, final File serverDirectory) throws MojoExecutionException
{
  try
  {
    unzip(serverDistributionArtifactFile, serverDirectory.getPath(), 0);
  }
  catch (final IOException ex)
  {
    throw new MojoExecutionException("Unable to extract CTK server distribution: "  + serverDistributionArtifactFile, ex);
  }
}

代码示例来源:origin: com.atlassian.maven.plugins/amps-maven-plugin

private void extractApplicationPlugins(final List<ProductArtifact> products, final File bundledPluginsDir)
    throws RuntimeException, IOException
{
  for (final ProductArtifact product : products)
  {
    final File artifact = resolveArtifactForProduct(product).getFile();
    log.info("Extracting " + artifact.getAbsolutePath() + " into " + bundledPluginsDir.getAbsolutePath());
    unzip(artifact, bundledPluginsDir.getAbsolutePath(), 0, true, Pattern.compile(".*\\.jar"));
    log.debug("Extracted.");
  }
}

代码示例来源:origin: com.atlassian.maven.plugins/maven-amps-plugin

/**
 * Copies/Extracts the data into parent/directoryName
 * @throws MojoExecutionException
 */
private void extractHome(File target, Product studio) throws MojoExecutionException
{
  // Take whichever is provided by the user (dataPath or productDataVersion zip to download)
  File testResourcesZip = getProductHomeData(studio);
  try
  {
    if (!testResourcesZip.exists())
    {
      throw new MojoExecutionException(String.format("This source doesn't exist: %s", testResourcesZip.getAbsoluteFile()));
    }
    if (testResourcesZip.isDirectory())
    {
      copyDirectory(testResourcesZip, target);
    }
    else
    {
      unzip(testResourcesZip, target.getAbsolutePath(), 2);
    }
  }
  catch (IOException ioe)
  {
    throw new MojoExecutionException(String.format("Unable to copy/unzip the studio home from %s to %s", testResourcesZip.getAbsolutePath(),
        target.getAbsolutePath()), ioe);
  }
}

代码示例来源:origin: com.atlassian.maven.plugins/amps-maven-plugin

protected void extractProductHomeData(File productHomeData, File homeDir, Product ctx)
    throws MojoExecutionException
{
  final File tmpDir = new File(getBaseDirectory(ctx), "tmp-resources");
  tmpDir.mkdir();
  try
  {
    if (productHomeData.isFile())
    {
      File tmp = new File(getBaseDirectory(ctx), ctx.getId() + "-home");
      unzip(productHomeData, tmpDir.getPath());
      File rootDir = getRootDir(tmpDir, ctx);
      FileUtils.copyDirectory(rootDir, getBaseDirectory(ctx), true);
      moveDirectory(tmp, homeDir);
    }
    else if (productHomeData.isDirectory())
    {
      FileUtils.copyDirectory(productHomeData, homeDir, true);
    }
  }
  catch (final IOException ex)
  {
    throw new MojoExecutionException("Unable to copy home directory", ex);
  }
}

代码示例来源:origin: com.atlassian.maven.plugins/maven-amps-plugin

protected void extractProductHomeData(File productHomeData, File homeDir, Product ctx)
    throws MojoExecutionException
{
  final File tmpDir = new File(getBaseDirectory(ctx), "tmp-resources");
  tmpDir.mkdir();
  try
  {
    if (productHomeData.isFile())
    {
      File tmp = new File(getBaseDirectory(ctx), ctx.getId() + "-home");
      unzip(productHomeData, tmpDir.getPath());
      File rootDir = getRootDir(tmpDir, ctx);
      FileUtils.copyDirectory(rootDir, getBaseDirectory(ctx), true);
      moveDirectory(tmp, homeDir);
    }
    else if (productHomeData.isDirectory())
    {
      FileUtils.copyDirectory(productHomeData, homeDir, true);
    }
  }
  catch (final IOException ex)
  {
    throw new MojoExecutionException("Unable to copy home directory", ex);
  }
}

代码示例来源:origin: com.atlassian.maven.plugins/maven-amps-plugin

if (!appDir.exists())
  unzip(app, appDir.getAbsolutePath());

代码示例来源:origin: com.atlassian.maven.plugins/amps-maven-plugin

if (!appDir.exists())
  unzip(app, appDir.getAbsolutePath());

代码示例来源:origin: com.atlassian.maven.plugins/maven-amps-plugin

unzip(bundledPluginsFile, bundledPluginsDir.getPath());

代码示例来源:origin: com.atlassian.maven.plugins/amps-maven-plugin

unzip(bundledPluginsFile, bundledPluginsDir.getPath());

代码示例来源:origin: com.atlassian.maven.plugins/amps-maven-plugin

@Override
protected File extractApplication(Product ctx, File homeDir) throws MojoExecutionException
{
  File appDir = createDirectory(getAppDirectory(ctx));
  ProductArtifact defaults = getArtifact();
  ProductArtifact artifact = new ProductArtifact(
      firstNotNull(ctx.getGroupId(), defaults.getGroupId()),
      firstNotNull(ctx.getArtifactId(), defaults.getArtifactId()),
      firstNotNull(ctx.getVersion(), defaults.getVersion()));
  final File cruDistZip = goals.copyDist(getBuildDirectory(), artifact);
  try
  {
    // We remove one level of root folder from the zip if present
    int nestingLevel = ZipUtils.countNestingLevel(cruDistZip);
    unzip(cruDistZip, appDir.getPath(), nestingLevel > 0 ? 1 : 0);
  }
  catch (final IOException ex)
  {
    throw new MojoExecutionException("Unable to extract application ZIP artifact", ex);
  }
  return appDir;
}

代码示例来源:origin: com.atlassian.maven.plugins/maven-amps-plugin

@Override
protected File extractApplication(Product ctx, File homeDir) throws MojoExecutionException
{
  File appDir = createDirectory(getAppDirectory(ctx));
  ProductArtifact defaults = getArtifact();
  ProductArtifact artifact = new ProductArtifact(
      firstNotNull(ctx.getGroupId(), defaults.getGroupId()),
      firstNotNull(ctx.getArtifactId(), defaults.getArtifactId()),
      firstNotNull(ctx.getVersion(), defaults.getVersion()));
  final File cruDistZip = goals.copyDist(getBuildDirectory(), artifact);
  try
  {
    // We remove one level of root folder from the zip if present
    int nestingLevel = ZipUtils.countNestingLevel(cruDistZip);
    unzip(cruDistZip, appDir.getPath(), nestingLevel > 0 ? 1 : 0);
  }
  catch (final IOException ex)
  {
    throw new MojoExecutionException("Unable to extract application ZIP artifact", ex);
  }
  return appDir;
}

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