Java URL Create createURL(String url)

Here you can find the source of createURL(String url)

Description

converts a string into an url via the utf-8 encoder

License

Open Source License

Parameter

Parameter Description
url url string URL#URL(String)

Return

a wrapped url or null if an exception was thrown

Declaration

public static URL createURL(String url) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.net.URL;

public class Main {
    /**/*from  w  w  w.  j  a va2s.c  o m*/
     * converts a string into an url via the utf-8 encoder
     * @param url url string {@link URL#URL(String)}
     * @return a wrapped url or null if an exception was thrown
     */
    public static URL createURL(String url) {
        try {
            return new URL(url);
        } catch (Exception e) {
            return null;
        }
    }
}

Related

  1. createUrl(String spec)
  2. createURL(String spec, URLStreamHandlerFactory urlHandlerFactory)
  3. createURL(String src, File basedir)
  4. createURL(String str)
  5. createURL(String url)
  6. createURL(String url)
  7. createURL(String url, String baseURI)
  8. createURL(String urlString)
  9. toUrl(String filename)