class JarUtilities {

    public static Collection<? extends URL> listFiles(ClassLoader classLoader, String path, int depth)
    {
        Collection<URL> results = new ArrayList<>();
        Enumeration<URL> resources;
        try
        {
            resources = classLoader.getResources(path);
            while (resources.hasMoreElements())
            {
                URL url = resources.nextElement();
                File file = new File(url.getFile());
                if (file.isFile() || depth == 0)
                {
                    results.add(url);
                }
                else if (file.isDirectory())
                {
                    getFilesInDirectory(path, file, depth - 1, results);
                }
                else
                {
                    getFilesInJar(path, url, depth, results);
                }
            }
        }
        catch (IOException e)
        {
            LOGGER.warn("Failed to load resources: " + e, e);
        }
        return results;
    }

    private  JarUtilities();

}