List of utility methods to do Class Path Create
String | getClassBasePath(URL classUrl, Class> clazz) get Class Base Path return getClassBasePath(classUrl, clazz.getName());
|
List | getClassPathArchiveContents(final URL resource) If the resource represents a classpath archive (i.e.
final List<String> contents = new ArrayList<String>(); if (isArchive(resource)) { final ZipFile archive = getArchive(resource); if (archive != null) { for (final Enumeration<? extends ZipEntry> entries = archive.entries(); entries .hasMoreElements();) { final ZipEntry entry = entries.nextElement(); contents.add(entry.getName()); ... |
URL | getClasspathResourceURL(String resourceName) Get URL of a classpath resource return Thread.currentThread().getContextClassLoader().getResource(resourceName);
|
URL | getClasspathUrl(final Class> aClass, final String aPath) get Classpath Url if (aPath != null && aPath.startsWith(CLASSPATH_PREFIX)) { return getResourceUrl(aClass, aPath.substring(CLASSPATH_PREFIX.length())); } else { return null; |
URL | getClasspathURL(final String name) Gets the class path of a resource. return ClassLoader.getSystemResource(name);
|
URL[] | getClasspathURLs(String classpath) Utility method that converts the components of a String representing a classpath into file URL (s).
StringTokenizer st = new StringTokenizer(classpath, File.pathSeparator); URL[] urls = new URL[st.countTokens()]; for (int i = 0; st.hasMoreTokens(); i++) { urls[i] = new File(st.nextToken()).getCanonicalFile().toURI().toURL(); return urls; |