Java URL Value Check isURL(Object obj)

Here you can find the source of isURL(Object obj)

Description

is URL

License

Open Source License

Declaration

public static boolean isURL(Object obj) 

Method Source Code

//package com.java2s;
/*/*from   w  w w .j a  v a  2 s.  co  m*/
 * Copyright (c) 2012-2014 Veniamin Isaias.
 *
 * This file is part of web4thejob.
 *
 * Web4thejob is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or any later version.
 *
 * Web4thejob is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with web4thejob.  If not, see <http://www.gnu.org/licenses/>.
 */

import java.net.URL;

public class Main {
    public static boolean isURL(Object obj) {
        try {
            new URL(obj.toString());
            return true;
        } catch (Exception e) {
            return false;
        }

    }
}

Related

  1. isNewer(URL file, URL reference)
  2. isResponseCode(String url, int expectedCode)
  3. isResponsive(URL url)
  4. isSameFile(URL u, File out)
  5. isURL(final String urlString)
  6. isUrl(String input)
  7. isURL(String name)
  8. isURL(String possibleURL)
  9. isUrl(String resourceLocation)