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


Java ConstantString类代码示例

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


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

示例1: pushByConstant

import org.apache.bcel.classfile.ConstantString; //导入依赖的package包/类
private void pushByConstant(DismantleBytecode dbc, Constant c) {
	
if (c instanceof ConstantInteger)
	push(new Item("I", new Integer(((ConstantInteger) c).getBytes())));
else if (c instanceof ConstantString) {
	int s = ((ConstantString) c).getStringIndex();
	push(new Item("Ljava/lang/String;", getStringFromIndex(dbc, s)));
}
else if (c instanceof ConstantFloat)
	push(new Item("F", new Float(((ConstantInteger) c).getBytes())));
else if (c instanceof ConstantDouble)
	push(new Item("D", new Double(((ConstantDouble) c).getBytes())));
else if (c instanceof ConstantLong)
	push(new Item("J", new Long(((ConstantLong) c).getBytes())));
else
	throw new UnsupportedOperationException("Constant type not expected" );
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:18,代码来源:OpcodeStack.java

示例2: visitConstantString

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

示例3: visit

import org.apache.bcel.classfile.ConstantString; //导入依赖的package包/类
@Override
public void visit(ConstantValue s) {
    if (!visitingField())
        return;
    int i = s.getConstantValueIndex();
    Constant c = getConstantPool().getConstant(i);
    if (c instanceof ConstantString) {
        String value = ((ConstantString) c).getBytes(getConstantPool());
        if (value.length() < SIZE_OF_HUGE_CONSTANT)
            return;
        String key = getStringKey(value);
        definition.put(key, XFactory.createXField(this));
        stringSize.put(key, value.length());
    }

}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:17,代码来源:HugeSharedStringConstants.java

示例4: pushByConstant

import org.apache.bcel.classfile.ConstantString; //导入依赖的package包/类
private void pushByConstant(DismantleBytecode dbc, Constant c) {

        if (c instanceof ConstantClass)
            push(new Item("Ljava/lang/Class;", ((ConstantClass) c).getConstantValue(dbc.getConstantPool())));
        else if (c instanceof ConstantInteger)
            push(new Item("I", Integer.valueOf(((ConstantInteger) c).getBytes())));
        else if (c instanceof ConstantString) {
            int s = ((ConstantString) c).getStringIndex();
            push(new Item("Ljava/lang/String;", getStringFromIndex(dbc, s)));
        } else if (c instanceof ConstantFloat)
            push(new Item("F", Float.valueOf(((ConstantFloat) c).getBytes())));
        else if (c instanceof ConstantDouble)
            push(new Item("D", Double.valueOf(((ConstantDouble) c).getBytes())));
        else if (c instanceof ConstantLong)
            push(new Item("J", Long.valueOf(((ConstantLong) c).getBytes())));
        else
            throw new UnsupportedOperationException("Constant type not expected");
    }
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:19,代码来源:OpcodeStack.java

示例5: pushByConstant

import org.apache.bcel.classfile.ConstantString; //导入依赖的package包/类
private void pushByConstant(DismantleBytecode dbc, Constant c) {

        if (c instanceof ConstantClass)
            push(new Item("Ljava/lang/Class;", ((ConstantClass) c).getConstantValue(dbc.getConstantPool())));
        else if (c instanceof ConstantInteger)
            push(new Item("I", Integer.valueOf(((ConstantInteger) c).getBytes())));
        else if (c instanceof ConstantString) {
            int s = ((ConstantString) c).getStringIndex();
            push(new Item("Ljava/lang/String;", getStringFromIndex(dbc, s)));
        } else if (c instanceof ConstantFloat)
            push(new Item("F", Float.valueOf(((ConstantFloat) c).getBytes())));
        else if (c instanceof ConstantDouble)
            push(new Item("D", Double.valueOf(((ConstantDouble) c).getBytes())));
        else if (c instanceof ConstantLong)
            push(new Item("J", Long.valueOf(((ConstantLong) c).getBytes())));
        else
            throw new UnsupportedOperationException("StaticConstant type not expected");
    }
 
开发者ID:OpenNTF,项目名称:FindBug-for-Domino-Designer,代码行数:19,代码来源:OpcodeStack.java

示例6: main

import org.apache.bcel.classfile.ConstantString; //导入依赖的package包/类
/**
 * Main class, to find strings in class files.
 * @param args Arguments to program.
 */
public static void main(String[] args) {
    try {
        JavaClass clazz = Repository.lookupClass(args[0]);
        ConstantPool cp = clazz.getConstantPool();
        Constant[] consts = cp.getConstantPool();


        for (int i = 0; i < consts.length; i++) {

            if (consts[i] instanceof ConstantString) {
                System.out.println("Found String: " +
                        ((ConstantString)consts[i]).getBytes(cp));
            }
        }
    }
    catch (Exception e) {
        e.printStackTrace();
    }
}
 
开发者ID:spacewalkproject,项目名称:spacewalk,代码行数:24,代码来源:FindStrings.java

示例7: addString

import org.apache.bcel.classfile.ConstantString; //导入依赖的package包/类
/**
 * Add a new String constant to the ConstantPool, if it is not already in there.
 *
 * @param str String to add
 * @return index of entry
 */
public int addString( String str ) {
    int ret;
    if ((ret = lookupString(str)) != -1) {
        return ret; // Already in CP
    }
    int utf8 = addUtf8(str);
    adjustSize();
    ConstantString s = new ConstantString(utf8);
    ret = index;
    constants[index++] = s;
    if (!string_table.containsKey(str)) {
        string_table.put(str, new Index(ret));
    }
    return ret;
}
 
开发者ID:Hu6,项目名称:VestaClient,代码行数:22,代码来源:ConstantPoolGen.java

示例8: visitLDC

import org.apache.bcel.classfile.ConstantString; //导入依赖的package包/类
/** Checks if the constraints of operands of the said instruction(s) are satisfied. */
// LDC and LDC_W (LDC_W is a subclass of LDC in BCEL's model)
public void visitLDC(LDC o){
	indexValid(o, o.getIndex());
	Constant c = cpg.getConstant(o.getIndex());
	if (c instanceof ConstantClass){
	  addMessage("Operand of LDC or LDC_W is CONSTANT_Class '"+c+"' - this is only supported in JDK 1.5 and higher.");
	}
	else{
	  if (! ( (c instanceof ConstantInteger)	||
	          (c instanceof ConstantFloat) 		||
              (c instanceof ConstantString) ) ){
          constraintViolated(o, "Operand of LDC or LDC_W must be one of CONSTANT_Integer, CONSTANT_Float or CONSTANT_String, but is '"+c+"'.");
	  }
	}
}
 
开发者ID:Hu6,项目名称:VestaClient,代码行数:17,代码来源:Pass3aVerifier.java

示例9: CPESSC_Visitor

import org.apache.bcel.classfile.ConstantString; //导入依赖的package包/类
private CPESSC_Visitor(JavaClass _jc){
	jc = _jc;
	cp = _jc.getConstantPool();
	cplen = cp.getLength();

	CONST_Class = org.apache.bcel.classfile.ConstantClass.class;
	/*
          CONST_Fieldref = org.apache.bcel.classfile.ConstantFieldref.class;
	CONST_Methodref = org.apache.bcel.classfile.ConstantMethodref.class;
	CONST_InterfaceMethodref = org.apache.bcel.classfile.ConstantInterfaceMethodref.class;
          */
	CONST_String = org.apache.bcel.classfile.ConstantString.class;
	CONST_Integer = org.apache.bcel.classfile.ConstantInteger.class;
	CONST_Float = org.apache.bcel.classfile.ConstantFloat.class;
	CONST_Long = org.apache.bcel.classfile.ConstantLong.class;
	CONST_Double = org.apache.bcel.classfile.ConstantDouble.class;
	CONST_NameAndType = org.apache.bcel.classfile.ConstantNameAndType.class;
	CONST_Utf8 = org.apache.bcel.classfile.ConstantUtf8.class;

	carrier = new DescendingVisitor(_jc, this);
	carrier.visit();
}
 
开发者ID:Hu6,项目名称:VestaClient,代码行数:23,代码来源:Pass2Verifier.java

示例10: visitLDC

import org.apache.bcel.classfile.ConstantString; //导入依赖的package包/类
/** Symbolically executes the corresponding Java Virtual Machine instruction. */ 
public void visitLDC(LDC o){
	Constant c = cpg.getConstant(o.getIndex());
	if (c instanceof ConstantInteger){
		stack().push(Type.INT);
	}
	if (c instanceof ConstantFloat){
		stack().push(Type.FLOAT);
	}
	if (c instanceof ConstantString){
		stack().push(Type.STRING);
	}
       if (c instanceof ConstantClass) {
           stack().push(new ObjectType("java.lang.Class"));
       }
}
 
开发者ID:jesusc,项目名称:eclectic,代码行数:17,代码来源:ExecutionVisitor.java

示例11: visitLDC_W

import org.apache.bcel.classfile.ConstantString; //导入依赖的package包/类
/** Symbolically executes the corresponding Java Virtual Machine instruction. */ 
public void visitLDC_W(LDC_W o){
	Constant c = cpg.getConstant(o.getIndex());
	if (c instanceof ConstantInteger){
		stack().push(Type.INT);
	}
	if (c instanceof ConstantFloat){
		stack().push(Type.FLOAT);
	}
	if (c instanceof ConstantString){
		stack().push(Type.STRING);
	}
       if (c instanceof ConstantClass) {
           stack().push(new ObjectType("java.lang.Class"));
       }
}
 
开发者ID:jesusc,项目名称:eclectic,代码行数:17,代码来源:ExecutionVisitor.java

示例12: visitLDC

import org.apache.bcel.classfile.ConstantString; //导入依赖的package包/类
/** Symbolically executes the corresponding Java Virtual Machine instruction. */ 
public void visitLDC(LDC o){
	Constant c = cpg.getConstant(o.getIndex());
	if (c instanceof ConstantInteger){
		stack().push(Type.INT);
	}
	if (c instanceof ConstantFloat){
		stack().push(Type.FLOAT);
	}
	if (c instanceof ConstantString){
		stack().push(Type.STRING);
	}
}
 
开发者ID:linchaolong,项目名称:ApkToolPlus,代码行数:14,代码来源:ExecutionVisitor.java

示例13: visitLDC_W

import org.apache.bcel.classfile.ConstantString; //导入依赖的package包/类
/** Symbolically executes the corresponding Java Virtual Machine instruction. */ 
public void visitLDC_W(LDC_W o){
	Constant c = cpg.getConstant(o.getIndex());
	if (c instanceof ConstantInteger){
		stack().push(Type.INT);
	}
	if (c instanceof ConstantFloat){
		stack().push(Type.FLOAT);
	}
	if (c instanceof ConstantString){
		stack().push(Type.STRING);
	}
}
 
开发者ID:linchaolong,项目名称:ApkToolPlus,代码行数:14,代码来源:ExecutionVisitor.java

示例14: visitLDC

import org.apache.bcel.classfile.ConstantString; //导入依赖的package包/类
/**
 * Ensures the specific preconditions of the said instruction.
 */
public void visitLDC(LDC o){
	// visitCPInstruction is called first.
	
	Constant c = cpg.getConstant(o.getIndex());
	if 	(!	(	( c instanceof ConstantInteger) ||
						( c instanceof ConstantFloat	)	||
						( c instanceof ConstantString )	)	){
		constraintViolated(o, "Referenced constant should be a CONSTANT_Integer, a CONSTANT_Float or a CONSTANT_String, but is '"+c+"'.");
	}
}
 
开发者ID:linchaolong,项目名称:ApkToolPlus,代码行数:14,代码来源:InstConstraintVisitor.java

示例15: visitLDC_W

import org.apache.bcel.classfile.ConstantString; //导入依赖的package包/类
/**
 * Ensures the specific preconditions of the said instruction.
 */
public void visitLDC_W(LDC_W o){
	// visitCPInstruction is called first.
	
	Constant c = cpg.getConstant(o.getIndex());
	if 	(!	(	( c instanceof ConstantInteger) ||
						( c instanceof ConstantFloat	)	||
						( c instanceof ConstantString )	)	){
		constraintViolated(o, "Referenced constant should be a CONSTANT_Integer, a CONSTANT_Float or a CONSTANT_String, but is '"+c+"'.");
	}
}
 
开发者ID:linchaolong,项目名称:ApkToolPlus,代码行数:14,代码来源:InstConstraintVisitor.java


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