Java Utililty Methods URL Value Check

List of utility methods to do URL Value Check

Description

The list of methods to do URL Value Check are organized into topic(s).

Method

booleanisJarURL(URL url)
is Jar URL
String protocol = url.getProtocol();
return "jar".equals(protocol) || "zip".equals(protocol) || "wsjar".equals(protocol)
        || "code-source".equals(protocol) && url.getPath().contains("!/");
booleanisJarURL(URL url)
Returns true if specified URL is a jar: URL, otherwise returns false
return "jar".equals(url.getProtocol());
booleanisJarURL(URL url)
Is this URL a Jar URL?
String surl = url.toString();
if (surl.endsWith(".jar") || surl.startsWith("jar:")) {
    return true;
return false;
booleanisJarURL(URL url)
is Jar URL
String protocol = url.getProtocol();
return (URL_PROTOCOL_JAR.equals(protocol) || URL_PROTOCOL_ZIP.equals(protocol)
        || URL_PROTOCOL_VFSZIP.equals(protocol) || URL_PROTOCOL_WSJAR.equals(protocol));
booleanisJBoss5Url(URL fileUrl)
Check if given URL is pointing to JBoss 5 VFS resource
final String protocol = fileUrl.getProtocol();
return JBOSS5_VFSZIP.equals(protocol) || JBOSS5_VFSMEMORY.equals(fileUrl.getProtocol());
booleanisLegalURL(final String url)
Proves if the given string is a valid URL.
if ((url == null) || (url.trim().length() == 0)) {
    return false;
try {
    final URL u = new URL(url);
    u.openConnection();
    return true;
} catch (final MalformedURLException e) {
...
booleanisLocal(URL aURL)
Returns whether a URL is local.
String url = aURL.toExternalForm().toLowerCase();
return url.startsWith("file:") || url.startsWith("jar:file:");
booleanisLocalFile(URL url)
Adapted from http://www.java2s.com/Code/Java/Network-Protocol/IsURLalocalfile.htm
return ((url.getProtocol().equals("file")) && (url.getHost() == null || url.getHost().equals("")));
booleanisLocalFile(URL url)
is Local File
if (url.getProtocol().equals("file") && (url.getAuthority() == null || url.getAuthority().equals(""))
        && (url.getHost() == null || url.getHost().equals(("")))) {
    return true;
return false;
booleanisLocalFile(URL url)
is Local File
try {
    if (url.getProtocol().equals(new File(url.getFile()).toURI().toURL().getProtocol())) {
        return true;
} catch (Throwable throwable) {
    throwable.printStackTrace();
return false;
...