Java URL Value Check isURL(String possibleURL)

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

Description

Check if string is a valid URL.

License

Open Source License

Parameter

Parameter Description
possibleURL String to check for being a URL.

Return

true if string is a URL.

Declaration


public static boolean isURL(String possibleURL) 

Method Source Code

//package com.java2s;
/*   Please see the license information at the end of this file. */

import java.net.*;

public class Main {
    /**   Check if string is a valid URL.
     *//w w w .  j  a  va2 s.c  om
     *   @param   possibleURL   String to check for being a URL.
     *
     *   @return                  true if string is a URL.
     */

    public static boolean isURL(String possibleURL) {
        boolean result = false;

        try {
            URL url = new URL(possibleURL);

            result = true;
        } catch (Exception e) {
        }

        return result;
    }
}

Related

  1. isSameFile(URL u, File out)
  2. isURL(final String urlString)
  3. isURL(Object obj)
  4. isUrl(String input)
  5. isURL(String name)
  6. isUrl(String resourceLocation)
  7. isUrl(String resourceLocation)
  8. isUrl(String s)
  9. isUrl(String s)