Here you can find the source of buildURL(String url)
Parameter | Description |
---|---|
url | the URL string. |
public static URL buildURL(String url)
//package com.java2s; //License from project: Open Source License import java.net.MalformedURLException; import java.net.URL; public class Main { /**/*from w w w.j a v a 2 s . c o m*/ * Builds URL object with the specified URL string. * * @param url the URL string. * @return the URL object. */ public static URL buildURL(String url) { try { return new URL(url); } catch (MalformedURLException e) { throw new IllegalArgumentException(e); } } /** * Builds URL object with the specified context and spec. * * @param context the context. * @param spec the spec. * @return the URL object. */ public static URL buildURL(URL context, String spec) { try { return new URL(context, spec); } catch (MalformedURLException e) { throw new IllegalArgumentException(e); } } }