Here you can find the source of isValidURI(String uri)
public static boolean isValidURI(String uri)
//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; } }