public static void unzip(ZipInputStream in, File dir) throws IOException { unzip(in, dir, entry -> true, Function.identity()); }
public static void unzip(String prefix, InputStream zipStream, File dir) throws IOException { try (ZipInputStream in = new ZipInputStream(new BufferedInputStream(zipStream))) { unzip(prefix, in, dir); } }
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); } }
public static void unzip(InputStream zipStream, File dir) throws IOException { try (ZipInputStream in = new ZipInputStream(new BufferedInputStream(zipStream))) { unzip(in, dir); } }
public static void unzipIgnoreDirs(ZipInputStream in, File dir) throws IOException { unzip(in, dir, entry -> !entry.isDirectory(), Function.identity()); }
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); } }
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); } }
public static void unzip(File zip, File dir) throws IOException { try (ZipInputStream in = new ZipInputStream(new BufferedInputStream(new FileInputStream(zip)))) { unzip(in, dir); } }
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); } }
public static void unzip(URL zip, File dir) throws IOException { try (ZipInputStream in = new ZipInputStream(new BufferedInputStream(zip.openStream()))) { unzip(in, dir); } }
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())); }
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); } }
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; } }
/** * @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); } }
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); } }
unzipDir.mkdirs(); ZipUtils.unzip(oooFile, unzipDir);
@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; }
deleteDir = true; bundleDir = getTempBundleDir(bundle); ZipUtils.unzip(file, bundleDir);