当前位置: 首页>>代码示例>>Java>>正文


Java ClassPath.ClassFile方法代码示例

本文整理汇总了Java中org.apache.bcel.util.ClassPath.ClassFile方法的典型用法代码示例。如果您正苦于以下问题:Java ClassPath.ClassFile方法的具体用法?Java ClassPath.ClassFile怎么用?Java ClassPath.ClassFile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.bcel.util.ClassPath的用法示例。


在下文中一共展示了ClassPath.ClassFile方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getDisplayList

import org.apache.bcel.util.ClassPath; //导入方法依赖的package包/类
public static VectorD getDisplayList(String sourceFileName, String className) {
VectorD displayList = (VectorD) table.get(sourceFileName);
String sourceFilePath;

if (displayList != null) return displayList;
if (sourceFileName.equals("UnknownFile.java")) return new VectorD();

BufferedReader r;
  
if (Debugger.DEMO) return getDemoList(sourceFileName);

ClassPath.ClassFile cf = Repository.lookupClassFile(className);

if (cf != null) sourceFilePath = getSourceFileName(cf, sourceFileName);
else sourceFilePath = getSourceFileName(className, sourceFileName);

r = getReader(sourceFilePath);
if (r == null) r = getReaderFN(sourceFileName, className); 
if (r == null) r = getReaderFN2(sourceFileName, className);
return(buildFileLines(r, sourceFileName));
   }
 
开发者ID:OmniscientDebugger,项目名称:LewisOmniscientDebugger,代码行数:22,代码来源:CodePane.java

示例2: lookupClassFile

import org.apache.bcel.util.ClassPath; //导入方法依赖的package包/类
/**
 * @return class file object for given Java class by looking on the
 *  system class path; returns null if the class file can't be
 *  found
 */
public static ClassPath.ClassFile lookupClassFile( String class_name ) {
    try {
        ClassPath path = _repository.getClassPath();
        if (path == null) {
            return null;
        }
        return path.getClassFile(class_name);
    } catch (IOException e) {
        return null;
    }
}
 
开发者ID:Hu6,项目名称:VestaClient,代码行数:17,代码来源:Repository.java

示例3: getSourceFileName

import org.apache.bcel.util.ClassPath; //导入方法依赖的package包/类
private static String getSourceFileName(ClassPath.ClassFile cf, String sourceFileName) {
    String path = cf.getPath();
    int dot = path.lastIndexOf("/");
    if (dot < 0)
	return Debugger.DIRECTORY + sourceFileName;
    else
	return path.substring(0, dot+1)+sourceFileName;	// /export/home/.../RegressionTests/Quick.java
}
 
开发者ID:OmniscientDebugger,项目名称:LewisOmniscientDebugger,代码行数:9,代码来源:CodePane.java

示例4: getJavaClass

import org.apache.bcel.util.ClassPath; //导入方法依赖的package包/类
/**
 * Returns a JavaClass object which represents a class file with the given
 * name.
 * 
 * @param name - a fully qualified name of a class.
 * @return a JavaClass object which represents a class file with the given
 * name.
 * @throws ClassNotFoundException if a class file with the given name is
 * not found.
 */
public synchronized JavaClass getJavaClass(String name)
        throws ClassNotFoundException {
    try {
        // Try to get the class from the cache.
        JavaClass result = (JavaClass) cache.get(name);
        // If cache doesn't contain such a class load it from a class path.
        if (result == null) {
            // Get a file and parse its contents.
            ClassPath.ClassFile cf = classpath.getClassFile(name);
            InputStream is = cf.getInputStream();
            ClassParser parser = new ClassParser(is, cf.getPath());
            result = parser.parse();
            // Put the parsed class file into the cache.
            cache.put(name, result);

            if (verbose) {
                StringBuffer s = new StringBuffer();
                // If we use BCEL 5.1 or later one day we definitely
                // should remove the following if and replace 
                // cf.getPath() with cf.getBase()!
                if (!(is instanceof FileInputStream)) {
                    s.append("class.path:");
                }
                s.append(cf.getPath());
                System.out.println(name + " loaded from " + s);
            }
        } else {
            if (verbose) {
                System.out.println(name + " retrieved from a cache");
            }
        }
        return result;
    } catch (Exception e) {
        throw new ClassNotFoundException(name, e);
    }
}
 
开发者ID:shannah,项目名称:cn1,代码行数:47,代码来源:ClassProvider.java

示例5: lookupClassFile

import org.apache.bcel.util.ClassPath; //导入方法依赖的package包/类
/**
 * @return class file object for given Java class.
 */
public static ClassPath.ClassFile lookupClassFile(String class_name) {
    try {
        return ClassPath.SYSTEM_CLASS_PATH.getClassFile(class_name);
    } catch (IOException e) {
        return null;
    }
}
 
开发者ID:miuirussia,项目名称:KJBE,代码行数:11,代码来源:Repository.java


注:本文中的org.apache.bcel.util.ClassPath.ClassFile方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。