List of utility methods to do Resource Path Get
String | getResourcePath(Class> clazz, String fileName) get Resource Path URL resource = clazz.getResource(fileName);
return resource == null ? null : resource.getPath();
|
String | getResourcePath(final Class> bundleClazz, final String pathToFile) Returns the absolute path of the resource from the bundle final Bundle bundle = FrameworkUtil.getBundle(bundleClazz); final URL url = bundle.getEntry(pathToFile); return new File(url.getPath()).getAbsolutePath(); |
String | getResourcePath(Object object, String resource) Return the fully qualified path of the requested resource object. URL resourceURL = object.getClass().getClassLoader().getResource(resource); if (resourceURL != null) { try { return resourceURL.toURI().getPath(); } catch (URISyntaxException e) { return null; } else { ... |
String | getResourcePath(String fileName) Return the absolute path of the specified file resource on the classpath. URL url = Thread.currentThread().getContextClassLoader().getResource(fileName); if (url == null) { throw new IOException("Failed to locate resource " + fileName); File file; try { file = new File(url.toURI()); } catch (URISyntaxException urise) { ... |
String | getResourcePath(String filename) get Resource Path ClassLoader classloader = Thread.currentThread().getContextClassLoader();
return classloader.getResource(filename).toURI().toString();
|
String | getResourcePath(String name) get Resource Path URL pathUrl = Thread.currentThread().getContextClassLoader().getResource(name); if (pathUrl != null) { return pathUrl.getPath(); return null; |
String | getResourcePath(String path) get Resource Path URL dir_url = ClassLoader.getSystemResource(path);
return dir_url.getFile();
|
String | getResourcePath(String resource) Returns the path of the given resource. return getResourceURL(resource).getPath();
|
URL | getResourcePath(String resource) get Resource Path return ClassLoader.getSystemResource(resource);
|
Enumeration | getResources(ClassLoader cl, String resourcePath) Returns a resources founded from the ClassLoader. try { return cl == null ? ClassLoader.getSystemResources(resourcePath) : cl.getResources(resourcePath); } catch (IOException e) { e.printStackTrace(); return null; |