List of utility methods to do URL Value Check
boolean | isFileURL(URL url) Is this url a file url? if (url == null) { return false; String surl = url.toString(); return surl.startsWith("file:/"); |
boolean | isFileURL(URL url) Is this a file URL that is not also a Jar URL? String surl = url.toString(); if (surl.startsWith("file:") && !isJarURL(url)) { return true; return false; |
boolean | isFileURL(URL url) Returns true if the given URL is a reference to the local file system. String protocol = url.getProtocol(); String authority = url.getAuthority(); return (protocol != null) && protocol.equals("file") && ((authority == null) || authority.equals("") || authority.equalsIgnoreCase("localhost")); |
boolean | isFileUrl(URL url) Returns true if the specified url is to a file, i.e its protocol is file .
return url != null && FILE_PROTOCOL.equals(url.getProtocol());
|
boolean | isHosting(URL url_in) is Hosting return (tracker_ip.length() > 0 && url_in.getHost().equalsIgnoreCase(tracker_ip));
|
boolean | isHTTP(URL url) is HTTP if (url.getProtocol().equalsIgnoreCase("http")) return true; return false; |
boolean | isHttpOk(String url) is Http Ok HttpURLConnection conn = null; try { URL serverUrl = new URL(url); conn = (HttpURLConnection) serverUrl.openConnection(); conn.setConnectTimeout(1000 * 5); conn.setRequestMethod("GET"); conn.connect(); int state = conn.getResponseCode(); ... |
boolean | isHttpUrl(final URI toCheck) Determine if a URL is a URL using HTTP or HTTPS protocols return toCheck.getHost() != null && (toCheck.getScheme().equals("http") || toCheck.getScheme().equals("https")); |
boolean | isHttpUrl(final URL url) is Http Url final String protocol = url.getProtocol(); return "http".equalsIgnoreCase(protocol) || "https".equalsIgnoreCase(protocol); |
boolean | isHttpUrl(String in) is Http Url try { URL url = new URL(in); return url.getProtocol().toLowerCase().startsWith("http"); } catch (MalformedURLException ignored) { return false; |