List of utility methods to do Resource Get
URI | getResource(final String resource) get Resource return getClassLoader().getResource(resource).toURI();
|
URL | getResource(final String resourceName, final Class> caller) get Resource final String resource; if (resourceName.startsWith("/")) { resource = resourceName.substring(1); } else { final Package callerPackage = caller.getPackage(); if (callerPackage != null) { resource = callerPackage.getName().replace('.', '/') + '/' + resourceName; } else { ... |
URL | getResource(String filename) get Resource Thread currentThread = Thread.currentThread();
ClassLoader contextClassLoader = currentThread.getContextClassLoader();
return contextClassLoader.getResource(filename);
|
URL | getResource(String filename) Returns a url to a resource. URL url = ClassLoader.getSystemResource(filename); if (url == null) { url = Main.class.getResource(filename); if (url == null) { try { url = new File(filename).toURL(); } catch (MalformedURLException e) { return null; ... |
URL | getResource(String folder, String name) Get URL of a resource from a given folder .
return getResource(folder + "/" + name); |
InputStream | getResource(String inResource) trying to fetch data from the following resources CLASSPATH, FILE, URL return getResource(inResource, true);
|
String | getResource(String key, String bundleName, Locale locale) Returns the localized string with the given key from the given bundle. try { ResourceBundle bundle = ResourceBundle.getBundle(bundleName, locale); return bundle.getString(key); } catch (MissingResourceException e) { return "??? " + key + " ???"; |
URL | getResource(String name) get Resource ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); URL url = null; if ((name != null) && (name.indexOf(":/") > -1)) { try { url = new URL(name); } catch (Exception e) { if (url == null) { try { url = classLoader.getResource(name); } catch (Exception e) { if (url == null) { try { url = classLoader.getResource('/' + name); } catch (Exception e) { if (url == null) { try { url = classLoader.getResource("META-INF/" + name); } catch (Exception e) { return url; |
URL | getResource(String name) get Resource return Thread.currentThread().getContextClassLoader().getResource(name);
|
URL | getResource(String name) get Resource if (!name.startsWith("bio/gcat/")) name = "bio/gcat" + (name.startsWith("/") ? EMPTY : "/") + name; return localClassLoader.getResource(name); |