Check whether the zipfile contain the resources

@param zipfile
@param resources
@return
199527
public static boolean zipContainsDir(String zipfile, String resources) {

        Enumeration<? extends ZipEntry> entries = null;
        try {
            entries = (new ZipFile(zipfile)).entries();
            while (entries != null && entries.hasMoreElements()) {
                ZipEntry ze = entries.nextElement();
                String name = ze.getName();
                if (name.startsWith(resources + "/")) {
                    return true;
                }
            }
        } catch (IOException e) {
            // TODO Auto-generated catch block
            // e.printStackTrace();
            LOG.error(e + "zipContainsDir error");
        }

        return false;
    }
1040521
public static boolean isZip(String fileName) {
		if (fileName == null) {
			return false;
		}

		String tl = fileName.toLowerCase();
		for (String element : ZIP_EXTENSIONS) {
			if (tl.endsWith(element)) {
				return true;
			}
		}
		return false;
	}
18811
public static boolean containsEntry(File zip, String name) {
    ZipFile zf = null;
    try {
      zf = new ZipFile(zip);
      return zf.getEntry(name) != null;
    }
    catch (IOException e) {
      throw ZipExceptionUtil.rethrow(e);
    }
    finally {
      closeQuietly(zf);
    }
  }
642215
public boolean containsResource (String path)
    {
        try {
            if (resolveJarFile()) {
                return false;
            }
            return (_jarSource.getJarEntry(path) != null);
        } catch (IOException ioe) {
            return false;
        }
    }
449414
public static <T> HalFormsDocument<T> forResources(Collection<T> resources) {

		Assert.notNull(resources, "Resources must not be null!");

		return new HalFormsDocument<T>().withResources(resources);
	}
900612
public static boolean replaceEntries(final File zip, final ZipEntrySource[] entries) {
    return operateInPlace(zip, new InPlaceAction() {
      public boolean act(File tmpFile) {
        return replaceEntries(zip, entries, tmpFile);
      }
    });
  }
966356
public static void zipInto(File target, File... files) {
        ZipOutputStream zos = null;
        try {
            zos = new ZipOutputStream(new BufferedOutputStream(new FileOutputStream(target)));
            byte[] buffer = new byte[128];
            for (File f : files) {
                ZipEntry entry = new ZipEntry(f.getName());
                InputStream is = new BufferedInputStream(new FileInputStream(f));
                zos.putNextEntry(entry);
                int read = 0;
                while ((read = is.read(buffer)) != -1) {
                    zos.write(buffer, 0, read);
                }
                zos.closeEntry();
                IO.close(is);
            }
        } catch (IOException e) {
            throw E.ioException(e);
        } finally {
            IO.close(zos);
        }
    }
353130
public ZipFileBuilder asZip() {
        final ZipFileBuilder zfb = new ZipFileBuilder(folder, filename);
        if(this.content != null) {
            zfb.addResource(getContenFileName(), this.content);
        }
        return zfb;
    }
1215917
private boolean isZip(JarEntry entry) throws IOException {
        try (InputStream entryInputStream = sourceFatJar.getInputStream(entry)) {
            try (ZipInputStream zipInputStream = new ZipInputStream(entryInputStream)) {
                ZipEntry ze = zipInputStream.getNextEntry();
                if (ze == null) {
                    return false;
                }
                return true;
            }
        }
    }
904537
private static void zipFiles(final File file, final File dirToZip, final ZipOutputStream zos,
		final FilenameFilter fileFilter) throws IOException
	{
		if (file.isDirectory())
		{
			File[] fList;
			List<File> foundedFiles;
			if (null != fileFilter)
			{
				final File[] tmpfList = file.listFiles(fileFilter);
				final List<File> foundedDirs = FileSearchExtensions.listDirs(file);
				if (0 < foundedDirs.size())
				{
					final List<File> tmp = Arrays.asList(tmpfList);
					foundedDirs.addAll(tmp);
					foundedFiles = foundedDirs;
				}
				else
				{
					final List<File> tmp = Arrays.asList(tmpfList);
					foundedFiles = tmp;
				}
			}
			else
			{
				fList = file.listFiles();
				final List<File> tmp = Arrays.asList(fList);
				foundedFiles = tmp;
			}
			for (int i = 0; i < foundedFiles.size(); i++)
			{
				zipFiles(foundedFiles.get(i), dirToZip, zos, fileFilter);
			}
		}
		else
		{
			addFile(file, dirToZip, zos);
		}
	}
450750
public static boolean isFile(Resource resource) {
        return resource.isResourceType(ResourceUtil.TYPE_FILE) ||
                resource.isResourceType(ResourceUtil.TYPE_LINKED_FILE);
    }
1038306
public static Set<Path> getDirectoriesFromJar(Path pathToJarFile) throws IOException {
        Set<Path> result = new HashSet<Path>();
        ZipFile jarfile = new ZipFile(pathToJarFile.toFile());
        try {
            final Enumeration<? extends ZipEntry> entries = jarfile.entries();
            while (entries.hasMoreElements()) {
                ZipEntry entry = entries.nextElement();
                if (entry.isDirectory()) {
                    result.add(Paths.get(entry.getName()));
                }
            }
            jarfile.close();
        } finally {
            IOUtils.closeQuietly(jarfile);
        }
        return result;
    }
179213
@Override
    public ICodeBaseEntry lookupResource(String resourceName) {

        // Translate resource name, in case a resource name
        // has been overridden and the resource is being accessed
        // using the overridden name.
        resourceName = translateResourceName(resourceName);
        if (!entries.contains(resourceName)) {
            return null;
        }

        try {
            ZipInputStreamCodeBaseEntry z = map.get(resourceName);
            if (z != null) {
                return z;
            }
            ZipInputStream zis = new ZipInputStream(new FileInputStream(file));
            try {
                ZipEntry ze;

                boolean found = false;
                int countDown = 20;
                while ((ze = zis.getNextEntry()) != null && countDown >= 0) {
                    if (ze.getName().equals(resourceName)) {
                        found = true;
                    }
                    if (found) {
                        countDown--;
                        if (map.containsKey(ze.getName())) {
                            continue;
                        }
                        z = build(zis, ze);
                        map.put(ze.getName(), z);
                    }
                    zis.closeEntry();
                }
            } finally {
                zis.close();
            }
            z = map.get(resourceName);
            if (z == null) {
                throw new AssertionError("Could not find " + resourceName);
            }
            return z;
        } catch (IOException e) {
            return null;
        }
    }
1361024
private static FileSystem createZipFileSystem(String zipFilename, boolean create) throws IOException {

        // convert the filename to a URI
        final Path path = Paths.get(zipFilename);
        if(Files.notExists(path.getParent())) {
            Files.createDirectories(path.getParent());
        }
        final URI uri = URI.create("jar:file:" + path.toUri().getPath());

        final Map<String, String> env = new HashMap<>();
        if (create) {
            env.put("create", "true");
        }
        return FileSystems.newFileSystem(uri, env);
    }
938913
protected boolean isSarlResource(Object resource) {
		if (resource instanceof IFile) {
			final IFile file = (IFile) resource;
			return getFileExtensions().contains(file.getFileExtension());
		}
		return false;
	}
811547
def is_zipfile(filename):
    """"""
    try:
        fpin = open(filename, "rb")
        endrec = _EndRecData(fpin)
        fpin.close()
        if endrec:
            return True                 # file has correct magic number
    except IOError:
        pass
    return False
1036708
public static boolean isJavaArchive(IResource resource) {
        if (resource == null || (resource.getType() != IResource.FILE)) {
            return false;
        }
        String name = resource.getName();
        return Archive.isArchiveFileName(name);
    }