本文整理汇总了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);
}
示例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);
}
}
}
示例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);
}
}
}
}
示例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();
}
示例5: getStringFromIndex
import org.apache.bcel.classfile.ConstantUtf8; //导入方法依赖的package包/类
protected String getStringFromIndex(int i) {
ConstantUtf8 name = (ConstantUtf8) constantPool.getConstant(i);
return name.getBytes();
}
示例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();
}
示例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();
}