Here you can find the source of toURI(CharSequence uriStr)
Parameter | Description |
---|---|
uriStr | A char sequence containing a URI representation |
public static URI toURI(CharSequence uriStr)
//package com.java2s; //License from project: Apache License import java.net.URI; public class Main { /**//www . j a v a2 s .co m * Creates a URI from the passed string * @param uriStr A char sequence containing a URI representation * @return a URI */ public static URI toURI(CharSequence uriStr) { try { return new URI(nvl(uriStr, "Passed string was null").toString()); } catch (Exception e) { throw new RuntimeException("Failed to create URL from string [" + uriStr + "]", e); } } public static <T> T nvl(T t, String message) { if (t == null) throw new IllegalArgumentException(message); return (T) t; } }