Java URI Value Check isValidURI(String uri)

Here you can find the source of isValidURI(String uri)

Description

return true if this is a valid uri

License

Open Source License

Declaration

public static boolean isValidURI(String uri) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2004, 2007 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:/* w  ww  . j  av a  2s  .  co m*/
 * IBM Corporation - initial API and implementation
 * yyyymmdd bug      Email and other contact information
 * -------- -------- -----------------------------------------------------------
 *     IBM Corporation - Initial API and implementation
 *     Jens Lukowski/Innoopract - initial renaming/restructuring
 * 20071205   211262 ericdp@ca.ibm.com - Eric Peters, CopyWSDLTreeCommand fails to copy ?wsdl
 *******************************************************************************/

import java.net.URI;

public class Main {
    /**
     * return true if this is a valid uri
     */
    public static boolean isValidURI(String uri) {
        boolean result = false;
        try {
            new URI(uri);
            result = true;
        } catch (Exception e) {
        }
        return result;
    }
}

Related

  1. isUriValid(String uri)
  2. isUsingNonDefaultPort(URI uri)
  3. isValid(String uri)
  4. isValid(URI uri)
  5. isValidURI(final String namespace)
  6. isValidUri(String uri, StringBuilder errMsg)
  7. isValidUri(String uriCandidate)
  8. isValidURI(String uriRef)
  9. isValidURIorEmpty(String uri)