List of utility methods to do URL Create
URL | createUrl(final String spec) Creates a new URL from the specified URL spec. return createUrl(null, spec);
|
URL | createURL(final String url) create URL try { return new URL(url); } catch (MalformedURLException e) { throw new RuntimeException(e); |
URL | createURL(String fileName) create URL try { return new URL(fileName); } catch (MalformedURLException ex) { File file = new File(fileName); String path = file.getAbsolutePath(); String fs = System.getProperty("file.separator"); if (fs.length() == 1) { char sep = fs.charAt(0); ... |
java.net.URL | createUrl(String spec) create Url try { return new java.net.URL(spec); } catch (java.net.MalformedURLException murle) { throw new RuntimeException(spec, murle); |
URL | createURL(String spec, URLStreamHandlerFactory urlHandlerFactory) Tries to parse a String as an URL.
URLStreamHandler handler = getURLHandler(spec, urlHandlerFactory); URL url; try { if (handler == null) { url = new URL(spec); } else { url = new URL(null, spec, handler); } catch (MalformedURLException e) { url = null; return url; |
URL | createURL(String src, File basedir) Converts a string to a URL. URL srcURL; try { srcURL = new URL(src); } catch (MalformedURLException e) { File srcFile = new File(src); if (!srcFile.isAbsolute()) { srcFile = new File(basedir, src); srcURL = srcFile.toURI().toURL(); return srcURL; |
String | createURL(String str) create URL try { new URL(str); return null; } catch (MalformedURLException var2) { return "http://" + str; |
URL | createURL(String url) Create a URL, and throw a RuntimeException upon failure. try { return new URL(url); } catch (MalformedURLException e) { throw new RuntimeException(e); |
URL | createURL(String url) create URL URL requestURL; try { requestURL = new URL(url); return requestURL; } catch (MalformedURLException e) { try { requestURL = new URL("http://localhost:8080" + url); return requestURL; ... |
URL | createURL(String url) converts a string into an url via the utf-8 encoder try { return new URL(url); } catch (Exception e) { return null; |