Here you can find the source of isZipFile(File f)
Parameter | Description |
---|---|
f | -File object |
public static boolean isZipFile(File f)
//package com.java2s; //License from project: Open Source License import java.io.File; public class Main { /**/*from w w w. j a v a 2 s. c om*/ * isZipFile static method test if file name matches a zip file * @param f -File object * @return true if file name designated by File object is matching .zip pattern false otehrwise */ public static boolean isZipFile(File f) { if (f == null) return false; return isZipFile(f.getName()); } /** * isZipFile method to test if given file name matches zip file name. * @param str * @return - boolean true if file is zip type and false if it is not. */ public static boolean isZipFile(String str) { if (str == null) return false; if (str.length() < 3) return false; String tmp = str.substring(str.length() - 3, str.length()); if (tmp.toLowerCase().equals("zip")) return true; else return false; } }