Java URL Value Check isURL(String token)

Here you can find the source of isURL(String token)

Description

Returns true if the input token is a URL, and false otherwise.

License

Open Source License

Declaration

@SuppressWarnings("unused")
public static boolean isURL(String token) 

Method Source Code


//package com.java2s;
import java.net.MalformedURLException;
import java.net.URL;

public class Main {
    /**//  w  w w. j  a  va2  s  .c o  m
     * Returns true if the input token is a URL, and false otherwise.
     */
    @SuppressWarnings("unused")
    public static boolean isURL(String token) {
        try {
            URL url = new URL(token);
            return true;
        } catch (MalformedURLException e) {
            return false;
        }
    }
}

Related

  1. isUrl(String resourceLocation)
  2. isUrl(String resourceLocation)
  3. isUrl(String s)
  4. isUrl(String s)
  5. isURL(String str)
  6. isUrl(String value)
  7. isURLAccessible(String URL)
  8. isURLAvailable(String url, int timeout)
  9. isUrlAvailable(URL url, Proxy proxy)