gpt4 book ai didi

org.jboss.galleon.util.ZipUtils类的使用及代码示例

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

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

ZipUtils介绍

暂无

代码示例

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

public void install(String coords, Path artifact) throws ProvisioningException {
  try {
    final Path path = getArtifactPath(coords);
    Files.createDirectories(path.getParent());
    if(Files.isDirectory(artifact)) {
       ZipUtils.zip(artifact, path);
    }else {
      Files.copy(artifact, path, StandardCopyOption.REPLACE_EXISTING);
    }
  } catch (IOException ex) {
    throw new ProvisioningException("Failed to install artifact " + coords + " to " + artifact, ex);
  }
}

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

public static void unzip(Path zipFile, Path targetDir) throws IOException {
  if(!Files.exists(targetDir)) {
    Files.createDirectories(targetDir);
  }
  try (FileSystem zipfs = newFileSystem(zipFile)) {
    for (Path zipRoot : zipfs.getRootDirectories()) {
      copyFromZip(zipRoot, targetDir);
    }
  }
}

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

public static void zip(Path src, Path zipFile) throws IOException {
  try (FileSystem zipfs = newFileSystem(toZipUri(zipFile), Files.exists(zipFile) ? Collections.emptyMap() : CREATE_ENV)) {
    if(Files.isDirectory(src)) {
      try (DirectoryStream<Path> stream = Files.newDirectoryStream(src)) {
        for(Path srcPath : stream) {
          copyToZip(src, srcPath, zipfs);
        }
      }
    } else {
      Files.copy(src, zipfs.getPath(src.getFileName().toString()), StandardCopyOption.REPLACE_EXISTING);
    }
  }
}

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

public static byte[] hashJar(Path jarFile, boolean ignoreManifest) throws IOException {
  synchronized (DIGEST) {
    DIGEST.reset();
    try (FileSystem zipfs = ZipUtils.newFileSystem(jarFile)) {
      for (Path zipRoot : zipfs.getRootDirectories()) {
        final Map<String, Path> sortedChildren = new TreeMap<String, Path>();
        try(DirectoryStream<Path> stream = Files.newDirectoryStream(zipRoot)) {
          for(Path p : stream) {
            final String fileName = p.getFileName().toString();
            if(ignoreManifest && fileName.equals("META-INF/")) {
              continue;
            }
            sortedChildren.put(fileName, p);
          }
        }
        for (Path child : sortedChildren.values()) {
          updateDigest(DIGEST, child);
        }
      }
    }
    return DIGEST.digest();
  }
}

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

private void unpack(final Path fpDir, final Path artifactPath) throws ProvisioningException {
    try {
      Files.createDirectories(fpDir);
    } catch (IOException e) {
      throw new ProvisioningException(Errors.mkdirs(fpDir), e);
    }
    try {
      ZipUtils.unzip(artifactPath, fpDir);
    } catch (IOException e) {
      throw new ProvisioningException("Failed to unzip " + artifactPath + " to " + fpDir, e);
    }
  }
}

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

public static FeaturePackDescription describeFeaturePackZip(Path artifactZip) throws IOException, ProvisioningDescriptionException {
  try (FileSystem zipfs = ZipUtils.newFileSystem(artifactZip)) {
    for(Path zipRoot : zipfs.getRootDirectories()) {
      return describeFeaturePack(zipRoot, "UTF-8");
    }
  }
  return null;
}

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

ZipUtils.zip(tmpDir, pluginsDir.resolve(pluginFileName));
if(!plugins.isEmpty()) {
  for(Path plugin : plugins) {

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

public static FeaturePackSpec readSpec(Path artifactZip) throws ProvisioningException {
  try (FileSystem zipfs = ZipUtils.newFileSystem(artifactZip)) {
    for(Path zipRoot : zipfs.getRootDirectories()) {
      final Path p = zipRoot.resolve(Constants.FEATURE_PACK_XML);
      if(!Files.exists(p)) {
        throw new ProvisioningException("Feature-pack archive does not contain " + Constants.FEATURE_PACK_XML);
      }
      try(BufferedReader reader = Files.newBufferedReader(p)) {
        return FeaturePackXmlParser.getInstance().parse(reader);
      } catch (XMLStreamException e) {
        throw new ProvisioningException(Errors.parseXml(p), e);
      }
    }
  } catch (IOException e) {
    throw new ProvisioningException(Errors.readFile(artifactZip), e);
  }
  return null;
}

代码示例来源:origin: org.jboss.galleon/galleon-maven-plugins

IoUtils.recursiveDelete(zippedFP);
ZipUtils.zip(versionDir, zippedFP);
final Artifact artifact = new DefaultArtifact(
    groupDir.getFileName().toString(),

代码示例来源:origin: org.jboss.galleon/galleon-maven-plugin

IoUtils.recursiveDelete(zippedFP);
ZipUtils.zip(versionDir, zippedFP);
final Artifact artifact = new DefaultArtifact(
    groupDir.getFileName().toString(),

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

void install(FeaturePackLocation.FPID fpid, Path fpContentDir) throws ProvisioningException {
  Universe<?> universe = null;
  UniverseFeaturePackInstaller ufpInstaller = null;
  if (universeResolution) {
    universe = universeResolver.getUniverse(fpid.getLocation().getUniverse());
    ufpInstaller = ufpInstallers.get(universe.getFactoryId());
    if (ufpInstaller == null) {
      throw new ProvisioningException(Errors.featurePackInstallerNotFound(universe.getFactoryId(), ufpInstallers.keySet()));
    }
  }
  final Path fpZip = getBuildDir().resolve(LayoutUtils.ensureValidFileName(fpid.toString()));
  try {
    ZipUtils.zip(fpContentDir, fpZip);
  } catch (IOException e) {
    throw new ProvisioningException("Failed to create feature-pack archive", e);
  }
  if (ufpInstaller != null) {
    ufpInstaller.install(universe, fpid, fpZip);
  }
}

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