jetbrick-commons/src/main/java/jetbrick/beans/ClasspathUtils.java
public static Collection<URL> getClasspathURLs(ClassLoader classLoader, String packageName) {
        if (packageName == null) {
            throw new IllegalArgumentException("PackageName must be not null.");
        }
        Collection<URL> urls = new ArrayList<URL>();
        String dirname = packageName.replace('.', '/');
        try {
            Enumeration<URL> dirs = classLoader.getResources(dirname);
            while (dirs.hasMoreElements()) {
                urls.add(dirs.nextElement());
            }
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
        return urls;
    }
public static Collection<URL> getClasspathURLs(ClassLoader classLoader, String packageName) {
        if (packageName == null) {
            throw new IllegalArgumentException("PackageName must be not null.");
        }
        Collection<URL> urls = new ArrayList<URL>();
        String dirname = packageName.replace('.', '/');
        try {
            Enumeration<URL> dirs = classLoader.getResources(dirname);
            while (dirs.hasMoreElements()) {
                urls.add(dirs.nextElement());
            }
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
        return urls;
    }
public static Collection < URL > getClasspathURLs ( ClassLoader classLoader , String packageName ) { if ( packageName == null ) { throw new IllegalArgumentException ( "PackageName must be not null." ) ; } Collection < URL > urls = new ArrayList < URL > ( ) ; String dirname = packageName . replace ( ' ' , ' ' ) ; try { Enumeration < URL > dirs = classLoader . getResources ( dirname ) ; while ( dirs . hasMoreElements ( ) ) { urls . add ( dirs . nextElement ( ) ) ; } } catch ( IOException e ) { throw new RuntimeException ( e ) ; } return urls ; }
根据 classLoader 获取指定 package 对应的 URLs.
根据 classLoader 获取指定 package 对应的 URLs .