Here you can find the source of uri(String str)
public static URI uri(String str)
//package com.java2s; /*//from w w w . jav a 2 s. c o m * Copyright (c) 2013 Cisco Systems, Inc. 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 */ import java.net.URI; import java.net.URISyntaxException; public class Main { public static URI uri(String str) { try { return new URI(str); } catch (URISyntaxException e) { throw new IllegalArgumentException(e); } } }