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


Java ConstantUtf8.getBytes方法代码示例

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


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

示例1: visitClassContext

import org.apache.bcel.classfile.ConstantUtf8; //导入方法依赖的package包/类
@Override
public void visitClassContext(ClassContext classContext) {
    JavaClass jclass = classContext.getJavaClass();

    // We can ignore classes that were compiled for anything
    // less than JDK 1.5. This should avoid lots of unnecessary work
    // when analyzing code for older VM targets.
    if (BCELUtil.preTiger(jclass))
        return;

    boolean sawUtilConcurrentLocks = false;
    for (Constant c : jclass.getConstantPool().getConstantPool())
        if (c instanceof ConstantMethodref) {
            ConstantMethodref m = (ConstantMethodref) c;
            ConstantClass cl = (ConstantClass) jclass.getConstantPool().getConstant(m.getClassIndex());
            ConstantUtf8 name = (ConstantUtf8) jclass.getConstantPool().getConstant(cl.getNameIndex());
            String nameAsString = name.getBytes();
            if (nameAsString.startsWith("java/util/concurrent/locks"))
                sawUtilConcurrentLocks = true;

        }
    if (sawUtilConcurrentLocks)
        super.visitClassContext(classContext);
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:25,代码来源:FindUnreleasedLock.java

示例2: JavaClass

import org.apache.bcel.classfile.ConstantUtf8; //导入方法依赖的package包/类
/**
 * Read class definition from an input stream.
 * 
 * @param filename
 *          the name of the class file (used to determine the class name)
 * @param is
 *          the input stream to read the class file from
 * @throws IOException
 *           if I/O exception occurs while reading from the input stream
 */
public JavaClass(String filename, InputStream is) throws IOException {
  ClassParser parser = new ClassParser(is, filename);
  org.apache.bcel.classfile.JavaClass clazz = parser.parse();
  ConstantPool cp = clazz.getConstantPool();
  name = clazz.getClassName();

  for (Constant c : cp.getConstantPool()) {
    if (c instanceof ConstantClass) {
      ConstantClass cc = (ConstantClass) c;
      ConstantUtf8 cs = (ConstantUtf8) cp.getConstant(cc.getNameIndex());
      String cn = new String(cs.getBytes());
      if (cn.contains("["))
        continue;
      cn = cn.replaceAll("^\\[L", "");
      cn = cn.replaceAll(";", "");
      cn = cn.replaceAll("/", ".");
      getDependencies().add(cn);
    }
  }
}
 
开发者ID:mizdebsk,项目名称:java-deptools,代码行数:31,代码来源:JavaClass.java

示例3: visitConstantUtf8

import org.apache.bcel.classfile.ConstantUtf8; //导入方法依赖的package包/类
@Override
public void visitConstantUtf8(ConstantUtf8 obj) {
	String name = obj.getBytes();
	if (this.parser.isDebug()) {
		this.parser.debug("visitConstantUtf8: obj.getBytes(this.cp) = " + name);
	}
	if (SqlParseUtil.isSQL(name)) {
		List<TableInfo> tables = SqlParseUtil.parserSql(name);
		if (tables != null) {
			for (TableInfo table : tables) {
				this.jClass.getDetail().addTable(table);
			}
		}
	}
}
 
开发者ID:jdepend,项目名称:cooper,代码行数:16,代码来源:BigClassFileVisitor.java

示例4: getStringFromIndex

import org.apache.bcel.classfile.ConstantUtf8; //导入方法依赖的package包/类
private String getStringFromIndex(DismantleBytecode dbc, int i) {
	ConstantUtf8 name = (ConstantUtf8) dbc.getConstantPool().getConstant(i);
	return name.getBytes();
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:5,代码来源:OpcodeStack.java

示例5: getStringFromIndex

import org.apache.bcel.classfile.ConstantUtf8; //导入方法依赖的package包/类
protected String getStringFromIndex(int i) {
    ConstantUtf8 name = (ConstantUtf8) constantPool.getConstant(i);
    return name.getBytes();
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:5,代码来源:PreorderVisitor.java

示例6: getStringFromIndex

import org.apache.bcel.classfile.ConstantUtf8; //导入方法依赖的package包/类
private String getStringFromIndex(DismantleBytecode dbc, int i) {
    ConstantUtf8 name = (ConstantUtf8) dbc.getConstantPool().getConstant(i);
    return name.getBytes();
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:5,代码来源:OpcodeStack.java

示例7: getStringConstantBytes

import org.apache.bcel.classfile.ConstantUtf8; //导入方法依赖的package包/类
private String getStringConstantBytes(final ConstantPool constantPool, final int constantIndex) {
	final ConstantString constantString = (ConstantString) constantPool.getConstant(constantIndex);
	final ConstantUtf8 constantUtf8 =
			(ConstantUtf8) constantPool.getConstant(constantString.getStringIndex(), Constants.CONSTANT_Utf8);
	return constantUtf8.getBytes();
}
 
开发者ID:DesignAndDeploy,项目名称:dnd,代码行数:7,代码来源:FunctionBlockClass.java


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