gpt4 book ai didi

org.nuxeo.common.utils.ZipUtils.unzip()方法的使用及代码示例

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

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

ZipUtils.unzip介绍

暂无

代码示例

代码示例来源:origin: org.nuxeo.common/nuxeo-common

public static void unzip(ZipInputStream in, File dir) throws IOException {
  unzip(in, dir, entry -> true, Function.identity());
}

代码示例来源:origin: org.nuxeo.common/nuxeo-common

public static void unzip(String prefix, InputStream zipStream, File dir) throws IOException {
  try (ZipInputStream in = new ZipInputStream(new BufferedInputStream(zipStream))) {
    unzip(prefix, in, dir);
  }
}

代码示例来源:origin: org.nuxeo.common/nuxeo-common

public static void unzip(String prefix, URL zip, File dir) throws IOException {
  try (ZipInputStream in = new ZipInputStream(new BufferedInputStream(zip.openStream()))) {
    unzip(prefix, in, dir);
  }
}

代码示例来源:origin: org.nuxeo.common/nuxeo-common

public static void unzip(InputStream zipStream, File dir) throws IOException {
  try (ZipInputStream in = new ZipInputStream(new BufferedInputStream(zipStream))) {
    unzip(in, dir);
  }
}

代码示例来源:origin: org.nuxeo.common/nuxeo-common

public static void unzip(ZipInputStream in, File dir, PathFilter filter) throws IOException {
  if (filter == null) {
    unzip(in, dir);
  } else {
    unzip(in, dir, toPredicate(filter), Function.identity());
  }
}

代码示例来源:origin: org.nuxeo.common/nuxeo-common

public static void unzipIgnoreDirs(ZipInputStream in, File dir) throws IOException {
  unzip(in, dir, entry -> !entry.isDirectory(), Function.identity());
}

代码示例来源:origin: org.nuxeo.common/nuxeo-common

public static void unzip(String prefix, File zip, File dir) throws IOException {
  try (ZipInputStream in = new ZipInputStream(new BufferedInputStream(new FileInputStream(zip)))) {
    unzip(prefix, in, dir);
  }
}

代码示例来源:origin: org.nuxeo.common/nuxeo-common

public static void unzip(String prefix, File zip, File dir, PathFilter filter) throws IOException {
  try (ZipInputStream in = new ZipInputStream(new BufferedInputStream(new FileInputStream(zip)))) {
    unzip(prefix, in, dir, filter);
  }
}

代码示例来源:origin: org.nuxeo.common/nuxeo-common

public static void unzip(File zip, File dir) throws IOException {
  try (ZipInputStream in = new ZipInputStream(new BufferedInputStream(new FileInputStream(zip)))) {
    unzip(in, dir);
  }
}

代码示例来源:origin: org.nuxeo.common/nuxeo-common

public static void unzip(File zip, File dir, PathFilter filter) throws IOException {
  try (ZipInputStream in = new ZipInputStream(new BufferedInputStream(new FileInputStream(zip)))) {
    unzip(in, dir, filter);
  }
}

代码示例来源:origin: org.nuxeo.common/nuxeo-common

public static void unzip(URL zip, File dir) throws IOException {
  try (ZipInputStream in = new ZipInputStream(new BufferedInputStream(zip.openStream()))) {
    unzip(in, dir);
  }
}

代码示例来源:origin: org.nuxeo.common/nuxeo-common

public static void unzip(String prefix, ZipInputStream in, File dir, PathFilter filter) throws IOException {
  if (filter == null) {
    unzip(prefix, in, dir);
  } else {
    unzip(in, dir, toPredicate(filter).and(entry -> entry.getName().startsWith(prefix)),
        name -> name.substring(prefix.length()));
  }
}

代码示例来源:origin: org.nuxeo.common/nuxeo-common

public static void unzip(String prefix, ZipInputStream in, File dir) throws IOException {
  unzip(in, dir, entry -> entry.getName().startsWith(prefix), name -> name.substring(prefix.length()));
}

代码示例来源:origin: org.nuxeo.ecm.webengine/nuxeo-webengine-core

public static void copyResources(Bundle bundle, String path, File root) throws IOException {
  File file = Framework.getRuntime().getBundleFile(bundle);
  if (file == null) {
    throw new UnsupportedOperationException("Couldn't transform the bundle location into a file");
  }
  root.mkdirs();
  if (file.isDirectory()) {
    file = new File(file, path);
    FileUtils.copy(file.listFiles(), root);
  } else {
    ZipUtils.unzip(path, file, root);
  }
}

代码示例来源:origin: org.nuxeo.ecm.webengine/nuxeo-webengine-core

private static File explodeBundle(WebEngine engine, Bundle bundle, File bundleFile) throws IOException {
  if (bundleFile.isDirectory()) { // exploded jar - deploy it as is.
    return bundleFile;
  } else { // should be a JAR - we copy the bundle module content
    File moduleRoot = new File(engine.getRootDirectory(), "modules/" + bundle.getSymbolicName());
    if (moduleRoot.exists()) {
      if (bundleFile.lastModified() < moduleRoot.lastModified()) {
        // already deployed and JAR was not modified since.
        return moduleRoot;
      }
      // remove existing files
      FileUtils.deleteQuietly(moduleRoot);
    }
    // create the module root
    moduleRoot.mkdirs();
    // avoid unziping classes
    ZipUtils.unzip(bundleFile, moduleRoot, new PathFilter() {
      @Override
      public boolean isExclusive() {
        return false;
      }
      @Override
      public boolean accept(Path arg0) {
        return !arg0.lastSegment().endsWith(".class");
      }
    });
    return moduleRoot;
  }
}

代码示例来源:origin: org.nuxeo.runtime/nuxeo-runtime-reload

/**
 * @deprecated since 5.6, use {@link #runDeploymentPreprocessor()} instead. Keep it as compatibility code until
 *             NXP-9642 is done.
 */
@Override
@Deprecated
public void installWebResources(File file) throws IOException {
  log.info("Install web resources");
  if (file.isDirectory()) {
    File war = new File(file, "web");
    war = new File(war, "nuxeo.war");
    if (war.isDirectory()) {
      org.nuxeo.common.utils.FileUtils.copyTree(war, getAppDir());
    } else {
      // compatibility mode with studio 1.5 - see NXP-6186
      war = new File(file, "nuxeo.war");
      if (war.isDirectory()) {
        org.nuxeo.common.utils.FileUtils.copyTree(war, getAppDir());
      }
    }
  } else if (file.isFile()) { // a jar
    File war = getWarDir();
    ZipUtils.unzip("web/nuxeo.war", file, war);
    // compatibility mode with studio 1.5 - see NXP-6186
    ZipUtils.unzip("nuxeo.war", file, war);
  }
}

代码示例来源:origin: org.nuxeo.runtime/nuxeo-connect-standalone

public synchronized LocalPackage addPackage(File file) throws PackageException {
  if (file.isDirectory()) {
    return addPackageFromDir(file);
  } else if (file.isFile()) {
    File tmp = newTempDir(file.getName());
    try {
      ZipUtils.unzip(file, tmp);
      return addPackageFromDir(tmp);
    } catch (IOException e) {
      throw new PackageException("Failed to unzip package: " + file.getName());
    } finally {
      // cleanup tmp if exists
      org.apache.commons.io.FileUtils.deleteQuietly(tmp);
    }
  } else {
    throw new PackageException("Not found: " + file);
  }
}

代码示例来源:origin: org.nuxeo.template.rendering/nuxeo-template-rendering-core

unzipDir.mkdirs();
ZipUtils.unzip(oooFile, unzipDir);

代码示例来源:origin: org.nuxeo.ecm.platform/nuxeo-platform-convert

@Override
public String persist(String basePath) throws IOException {
  Path path = new Path(basePath);
  path = path.append(getHash());
  File dir = new File(path.toString());
  dir.mkdir();
  ZipUtils.unzip(zipBlob.getStream(), dir);
  key = dir.getAbsolutePath();
  // Check if creating an index.html file is needed
  load(path.toString());
  if (blobs != null && !blobs.get(0).getFilename().contains("index.html")) {
    log.info("Any index.html file found, generate a listing as index page.");
    File index = new File(dir, "index.html");
    if (index.createNewFile()) {
      Blob indexBlob = createIndexBlob();
      blobs.add(0, indexBlob);
      FileUtils.writeByteArrayToFile(index, indexBlob.getByteArray());
    } else {
      log.info("Unable to create index.html file");
    }
  }
  return key;
}

代码示例来源:origin: org.nuxeo.ecm.webengine/nuxeo-webengine-core

deleteDir = true;
bundleDir = getTempBundleDir(bundle);
ZipUtils.unzip(file, bundleDir);

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