Here you can find the source of isJarFileURL(URL url)
Parameter | Description |
---|---|
url | the URL to check |
public static boolean isJarFileURL(URL url)
//package com.java2s; //License from project: Open Source License import java.net.URL; public class Main { /** URL protocol for a file in the file system: "file" */ public static final String URL_PROTOCOL_FILE = "file"; /** File extension for a regular jar file: ".jar" */ public static final String JAR_FILE_EXTENSION = ".jar"; /**/*from w w w .j a va 2s . co m*/ * Determine whether the given URL points to a jar file itself, * that is, has protocol "file" and ends with the ".jar" extension. * @param url the URL to check * @return whether the URL has been identified as a JAR file URL * @since 4.1 */ public static boolean isJarFileURL(URL url) { return (URL_PROTOCOL_FILE.equals(url.getProtocol()) && url.getPath().toLowerCase().endsWith(JAR_FILE_EXTENSION)); } }