Here you can find the source of validateURI(final String uri)
Parameter | Description |
---|---|
uri | a parameter |
public static URI validateURI(final String uri)
//package com.java2s; /*/* w w w . jav a 2 s. c o m*/ * Copyright (c) 2006 Stephan D. Cote' - All rights reserved. * * This program and the accompanying materials are made available under the * terms of the MIT License which accompanies this distribution, and is * available at http://creativecommons.org/licenses/MIT/ * * Contributors: * Stephan D. Cote * - Initial concept and implementation */ import java.net.URI; public class Main { /** * Just test to see if the given string can be parse into a URI. * * @param uri * * @return TODO Complete Documentation */ public static URI validateURI(final String uri) { try { // We could try to open it, but even if it succeeds now, it may fail later // or if it fails right now, it may succeede later. So what is the use? return new URI(uri); } catch (final Exception mfue) { // System.err.println( "NetUtil.validateURI(String) The URI \"" + uri + "\" is not valid:\n" ); } return null; } }