List of utility methods to do Zip File Check
boolean | isZipContainsEntry(File zip, String relativePath) is Zip Contains Entry ZipFile zipFile = new ZipFile(zip); try { Enumeration en = zipFile.entries(); while (en.hasMoreElements()) { ZipEntry zipEntry = (ZipEntry) en.nextElement(); if (relativePath.equals(zipEntry.getName())) { return true; zipFile.close(); return false; } finally { zipFile.close(); |
boolean | isZipEntryPackage(String str) is Zip Entry Package if (str.length() < 18) return false; String t = cleanPath(str); String tmp = t.substring(0, 18); String test = "replicate" + File.separator + "inbound" + File.separator; if (tmp.equals(test)) { tmp = str.substring(str.length() - 4, str.length()); if (tmp.equals(".zip")) ... |
boolean | isZipFile(File f) is Zip File String s = null; if ((null == f) || (null == (s = f.getPath()))) { return false; } else { return (f.canRead() && !f.isDirectory() && (s.endsWith(".zip") || (s.endsWith(".jar")))); |
boolean | isZipFile(File f) isZipFile static method test if file name matches a zip file if (f == null) return false; return isZipFile(f.getName()); |
boolean | isZipFile(File f) is Zip File if (f != null) { if (f.getName().contains(".zip") || f.getAbsolutePath().contains(".zip")) { return true; return false; |
boolean | isZipFile(File f) is Zip File RandomAccessFile r; try { r = new RandomAccessFile(f, "r"); if (r.readInt() == 0x504b0304) { r.close(); return true; } else { r.close(); ... |
boolean | isZipFile(File f) Test if a file is a zip file. boolean isZip = true; byte[] buffer = new byte[MAGIC.length]; try { RandomAccessFile raf = new RandomAccessFile(f, "r"); raf.readFully(buffer); for (int i = 0; i < MAGIC.length; i++) { if (buffer[i] != MAGIC[i]) { isZip = false; ... |
boolean | isZipFile(File file) is Zip File return new ZipInputStream(new FileInputStream(file)).getNextEntry() != null; |
boolean | isZipFile(File file) Determine whether a file is a ZIP File. if (file.isDirectory()) { return false; if (!file.canRead()) { throw new IOException("Cannot read file " + file.getAbsolutePath()); if (file.length() < 4) { return false; ... |
boolean | isZipFile(File file) is Zip File final byte[] sig = new byte[] { 0x50, 0x4B, 0x3, 0x4 }; if (file.canRead()) { byte[] buf = new byte[4]; FileInputStream is = null; try { is = new FileInputStream(file); is.read(buf); } finally { ... |