以一个class包根目录获取所有的class文件
如果该目录为c:/bin 且目录结构为c:/bin/net/jueb/util/A.class 则有net.jueb.util.A这个类
@param classFolder
@return
433745
public static final HashMap<String,File> findClassByDirAndSub(File dir)
	{
		if(dir==null)
		{
			throw new NullArgumentException("dir ==null");
		}
		if(dir.isFile())
		{
			throw new IllegalArgumentException("dir "+dir+" is not a dir");
		}
		if(!dir.exists())
		{
			throw new IllegalArgumentException("dir "+dir+" not found");
		}
		HashMap<String,File> clazzs=new HashMap<String,File>();
		File clazzPath = dir;
		String Suffix=".class";
		if (clazzPath.exists() && clazzPath.isDirectory()) 
		{
			// 获取路径长度
			int clazzPathLen = clazzPath.getAbsolutePath().length() + 1;
			Stack<File> stack = new Stack<>();
			stack.push(clazzPath);
			// 遍历类路径
			while (stack.isEmpty() == false) 
			{
				File path = stack.pop();
				File[] classFiles = path.listFiles(new FileFilter() {
					@Override
					public boolean accept(File pathname) {
						return pathname.isDirectory() || pathname.getName().endsWith(Suffix);
					}
				});
				for (File subFile : classFiles) 
				{
					if (subFile.isDirectory()) 
					{
						stack.push(subFile);
					} else 
					{
						String className = subFile.getAbsolutePath();
						className = className.substring(clazzPathLen, className.length() - Suffix.length());
						className = className.replace(File.separatorChar, '.');
						clazzs.put(className, subFile);
					}
				}
			}
		}
		return clazzs;
	}
677033
public static ClassScanner getInstance(ClassLoader classLoader) {
        ClassScanner scanner = classScannerMap.putIfAbsent(classLoader, new ClassScanner());
        if (scanner == null) {
            scanner = classScannerMap.get(classLoader);
            scanner.classLoader = classLoader;
        } else {
            LOGGER.info("当前ClassLoader [{}] 对应的ClassScanner已存在，直接返回当前已存在的并且忽略设置ClassLoader",
                classLoader);
        }

        return scanner;
    }
787351
static String[] getClasspathClassNames() throws ZipException, IOException {
        final String[] classes = getClasspathFileNamesWithExtension(".class");
        for (int i = 0; i < classes.length; i++) {
            classes[i] = classes[i].substring(0, classes[i].length() - 6).replace("/", ".");
        }
        return classes;
    }
884678
public static String findMainClass(JarFile jarFile, String classesLocation)
            throws IOException {
        return doWithMainClasses(jarFile, classesLocation,
                new ClassNameCallback<String>() {
                    @Override
                    public String doWith(String className) {
                        return className;
                    }
                });
    }
849052
public static ArrayList<String> getClassPathList()
  {
    if (_classPathList != null)
      return _classPathList;

    ArrayList<String> list = new ArrayList<String>();

    String classPath = getClassPath();
    String []classPathArray
      = classPath.split("[" + getPathSeparatorChar() + "]");

    for (int i = 0; i < classPathArray.length; i++) {
      if (! list.contains(classPathArray[i]))
        list.add(classPathArray[i]);
    }

    _classPathList = list;

    return _classPathList;
  }
858492
public JavaClass lookupClass(String className) throws ClassNotFoundException {
        if (classesThatCantBeFound.contains(className)) {
            throw new ClassNotFoundException("Error while looking for class " + className + ": class not found");
        }
        String resourceName = className.replace('.', '/') + ".class";
        InputStream in = null;
        boolean parsedClass = false;

        try {

            in = getInputStreamForResource(resourceName);
            if (in == null) {
                classesThatCantBeFound.add(className);
                throw new ClassNotFoundException("Error while looking for class " + className + ": class not found");
            }

            ClassParser classParser = new ClassParser(in, resourceName);
            JavaClass javaClass = classParser.parse();
            parsedClass = true;

            return javaClass;
        } catch (IOException e) {
            classesThatCantBeFound.add(className);
            throw new ClassNotFoundException("IOException while looking for class " + className, e);
        } finally {
            if (in != null && !parsedClass) {
                try {
                    in.close();
                } catch (IOException ignore) {
                    // Ignore
                }
            }
        }
    }
30575
public List<Class<?>> getClassInfo(String root,String pkg) throws Exception
	{
		List<Class<?>> list=new ArrayList<Class<?>>();
		String suffix=".java";
		File rootDir=new File(root);
		Set<File> files=FileUtil.findFileByDirAndSub(rootDir, new FileFilter() {
			@Override
			public boolean accept(File pathname) {
				return pathname.isDirectory() || pathname.getName().endsWith(suffix);
			}
		});
		URLClassLoader loader=new URLClassLoader(new URL[]{rootDir.toURI().toURL()});
		try {
			// 获取路径长度
			int clazzPathLen = rootDir.getAbsolutePath().length() + 1;
			for(File file:files)
			{
				String className = file.getAbsolutePath();
				className = className.substring(clazzPathLen, className.length() - suffix.length());
				className = className.replace(File.separatorChar, '.');
				try {
					Class<?> clazz=loader.loadClass(className);
					String pkgName=clazz.getPackage().getName();
					if(pkgName.startsWith(pkg))
					{
						list.add(clazz);
					}
				} catch (Exception e) {
				}
			}
		} finally {
			loader.close();
		}
		return list;
	}
250399
public static String getClassPath(Class<?> c) {
		String strClassFullName = c.getName();
		String strClassName = strClassFullName.substring(strClassFullName
				.lastIndexOf(".") + 1);
		String strClassPathName = getClassPathName(c);

		ClassLoader cl = c.getClassLoader();
		if (cl == null) {
			cl = ClassLoader.getSystemClassLoader();
			return null;
		}

		URL urlClass = cl.getResource(strClassPathName);
		if (urlClass == null)
			return null;

		String strUrl = urlClass.toString();
		return strUrl.substring(0, strUrl.lastIndexOf(strClassName));
	}
1109352
@Override
    public DecompilationResult decompileClassFile(Path rootDir, Path classFilePath, Path outputDir)
                throws DecompilationException
    {
        Checks.checkDirectoryToBeRead(rootDir.toFile(), "Classes root dir");
        File classFile = classFilePath.toFile();
        Checks.checkFileToBeRead(classFile, "Class file");
        Checks.checkDirectoryToBeFilled(outputDir.toFile(), "Output directory");

        log.info("Decompiling .class '" + classFilePath + "' to '" + outputDir + "' from: '" + rootDir + "'");

        String name = classFilePath.normalize().toAbsolutePath().toString().substring(rootDir.toAbsolutePath().toString().length() + 1);
        final String typeName = StringUtils.removeEnd(name, ".class");// .replace('/', '.');

        DecompilationResult result = new DecompilationResult();
        try
        {
            DecompilerSettings settings = getDefaultSettings(outputDir.toFile());
            this.procyonConf.setDecompilerSettings(settings); // TODO: This is horrible mess.

            final ITypeLoader typeLoader = new CompositeTypeLoader(new WindupClasspathTypeLoader(rootDir.toString()), new ClasspathTypeLoader());
            WindupMetadataSystem metadataSystem = new WindupMetadataSystem(typeLoader);
            File outputFile = this.decompileType(settings, metadataSystem, typeName);
            result.addDecompiled(Collections.singletonList(classFilePath.toString()), outputFile.getAbsolutePath());
        }
        catch (Throwable e)
        {
            DecompilationFailure failure = new DecompilationFailure("Error during decompilation of "
                        + classFilePath.toString() + ":\n    " + e.getMessage(), Collections.singletonList(name), e);
            log.severe(failure.getMessage());
            result.addFailure(failure);
        }

        return result;
    }
274320
public Collection<String> scanClasses() {
        return scanJar(p -> Files.isRegularFile(p) && p.toString().endsWith(".class") && !isIgnored(p.toAbsolutePath()));
    }
773898
public static HttpFileService forClassPath(ClassLoader classLoader, String rootDir) {
        return HttpFileServiceBuilder.forClassPath(classLoader, rootDir).build();
    }
649127
public static Class<?> classForName(String className, ClassLoader classLoader)
    {
        try
        {
            Class<?> c = null;
            try
            {
                c = Class.forName(className, true, ReflectUtils.class.getClassLoader());
            }
            catch (ClassNotFoundException e)
            {
                try
                {
                    c = Class.forName(className);
                }
                catch (ClassNotFoundException e1)
                {
                    if (classLoader == null)
                    {
                        throw e1;
                    }
                    else
                    {
                        c = classLoader.loadClass(className);
                    }
                }
            }
            return c;
        }
        catch (ClassNotFoundException e)
        {
            throw new KunderaException(e);
        }
    }
31553
public static File getClasspathFile(String filename) {
    if(filename == null) {
      throw LOG.nullParameter("filename");
    }

    return getClasspathFile(filename, null);
  }
640966
private Enumeration<URL> getUrlsByPackge(ClassLoader classLoader, String packageName) {
        try {
            return classLoader.getResources(packageName);
        } catch (IOException e) {
            // 由于是扫描package下的class，即时出现异常，也忽略掉.
            log.warn("【警告】未找到包:'" + packageName + "'下的URL，将忽略此种错误情况.");
            return null;
        }
    }
1134218
protected ClassLoader getClassLoader() {
        ClassLoader loader = null;
        Package pkg = PackageCache.getProcessPackage(getProcessId());
        if (pkg != null) {
            loader = pkg.getCloudClassLoader();
        }
        if (loader == null) {
            loader = getClass().getClassLoader();
        }
        return loader;
    }
548223
public List<File> getClasspathFiles() {
        if (closed.get()) {
            throw new IllegalArgumentException("Cannot use a ScanResult after it has been closed");
        }
        final List<File> classpathElementOrderFiles = new ArrayList<>();
        for (final ClasspathElement classpathElement : classpathOrder) {
            final File file = classpathElement.getFile();
            if (file != null) {
                classpathElementOrderFiles.add(file);
            }
        }
        return classpathElementOrderFiles;
    }
627473
public static List<File> localFilesFromUrlClassLoader(final URLClassLoader urlClassLoader) {
        checkNotNull("urlClassLoader", urlClassLoader);

        final List<File> files = new ArrayList<>();

        final URL[] urls = urlClassLoader.getURLs();
        for (final URL url : urls) {
            if ("file".equals(url.getProtocol())) {
                files.add(asFile(url));
            }
        }

        return files;

    }