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

booleanisFileURL(URL url)
Is this url a file url?
if (url == null) {
    return false;
String surl = url.toString();
return surl.startsWith("file:/"); 
booleanisFileURL(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;
booleanisFileURL(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"));
booleanisFileUrl(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());
booleanisHosting(URL url_in)
is Hosting
return (tracker_ip.length() > 0 && url_in.getHost().equalsIgnoreCase(tracker_ip));
booleanisHTTP(URL url)
is HTTP
if (url.getProtocol().equalsIgnoreCase("http"))
    return true;
return false;
booleanisHttpOk(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();
...
booleanisHttpUrl(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"));
booleanisHttpUrl(final URL url)
is Http Url
final String protocol = url.getProtocol();
return "http".equalsIgnoreCase(protocol) || "https".equalsIgnoreCase(protocol);
booleanisHttpUrl(String in)
is Http Url
try {
    URL url = new URL(in);
    return url.getProtocol().toLowerCase().startsWith("http");
} catch (MalformedURLException ignored) {
return false;