List of utility methods to do URL Value Check
boolean | isHttpUrl(URL url) Returns true if the specified url protocol is http. String protocol = url.getProtocol();
return url != null && (HTTP_PROTOCOL.equals(protocol) || HTTPS_PROTOCOL.equals(protocol));
|
boolean | isHttpUrl(URL url) is Http Url return url != null && "http".equalsIgnoreCase(url.getProtocol()); |
boolean | isHttpURLAvailable(final String url) Executes an HTTP GET Request to the given URL, using a one second connect timeout and read timeout. return getHttpReturnCode(url) == HttpURLConnection.HTTP_OK;
|
boolean | isInternetReachable(String url) is Internet Reachable try { InetAddress address = InetAddress.getByName(url); if (address == null) { return false; } catch (UnknownHostException e) { return false; return true; |
boolean | isJar(URL url) is Jar if (url.getProtocol() != null && url.getProtocol().length() > 0) { if (url.getProtocol().equalsIgnoreCase("jar")) { return true; return url.getPath().endsWith(".jar"); |
boolean | isJarFile(URL url) is Jar File URI uri; try { uri = url.toURI(); } catch (URISyntaxException e) { throw new IOException(e); String scheme = uri.getScheme(); if (scheme.equals("jar")) { ... |
boolean | isJarFile(URLConnection connection) is Jar File return connection.getURL().toString().endsWith(JAR_EXTENSION);
|
boolean | isJarFileURL(URL url) Determine whether the given URL points to a jar file itself, that is, has protocol "file" and ends with the ".jar" extension. return (URL_PROTOCOL_FILE.equals(url.getProtocol())
&& url.getPath().toLowerCase().endsWith(JAR_FILE_EXTENSION));
|
boolean | isJarURL(URL url) is Jar URL return URL_PROTOCOL_JAR.equals(url.getProtocol());
|
boolean | isJarURL(URL url) Determine whether the given URL points to a resource in a jar file, that is, has protocol "jar", "zip", "wsjar" or "code-source". String protocol = url.getProtocol();
return (URL_PROTOCOL_JAR.equals(protocol) || URL_PROTOCOL_ZIP.equals(protocol)
|| URL_PROTOCOL_WSJAR.equals(protocol)
|| (URL_PROTOCOL_CODE_SOURCE.equals(protocol) && url.getPath().contains(JAR_URL_SEPARATOR)));
|