List of utility methods to do Path to URL
URL | getURL(String path, URL context) Given an address and the context (referrer URL/current directory), try to create a URL object. URL result; if (context == null) { result = resolveFile(new File(path)); if (result != null) return result; try { result = new URL(context, path); ... |
URL | getUrl(String pluginId, String relativePath) Return an URL for the file located within the installation directory of the plug-in that has the given identifier that has the given relative path. Bundle bundle; if (pluginId == null || relativePath == null) { return null; bundle = Platform.getBundle(pluginId); if (bundle != null) { return bundle.getEntry(relativePath); return null; |
URL | getURL(String schema, String host, String path) get URL URL url = null; try { url = new URL(schema, host, "/" + path); } catch (MalformedURLException e) { return url; |
URL | getUrl(URL base, String path) Attempts to return a valid URL from either an absolute 'path' or a relative 'path' combined with 'base'. URL retVal = null; if (path != null) { try { retVal = new URL(path); } catch (MalformedURLException mue) { retVal = null; if (retVal == null && base != null) { ... |
URL | getUrlForLocalPath(String path) get Url For Local Path return new URL(new java.io.File(path).toURI().toURL().toString() + (path.endsWith(java.io.File.separator) ? "/" : "")); |
URL | getURLFromClassPath(String source) get URL From Class Path if (source.indexOf(":") >= 0) source = source.substring(source.indexOf(":")); return ClassLoader.getSystemResource(source); |
URL | getURLFromPath(String jarPath) get the URL from a given path string URL jarUrl; try { jarUrl = new URL(jarPath); } catch (MalformedURLException e) { try { jarUrl = new URL("file:" + jarPath); } catch (MalformedURLException ee) { throw new IllegalArgumentException("Unable to find jar:" + jarPath, ee); ... |
URL | getUrlFromPath(String path) get Url From Path if (isLocalPath(path)) { return new File(path).toURI().toURL(); } else { return new URL(path); |
URL | getUrlFromUrlPath(String path) get Url From Url Path try { return new URL(path); } catch (MalformedURLException e) { return null; |
String | getURLPath(URI uri) get URL Path if (uri.getScheme().equals("module")) { return "modules/" + uri.getAuthority() + uri.getPath(); } else { return uri.getPath().substring(1); |