Java Code Examples for com.sun.org.apache.bcel.internal.classfile.ConstantUtf8#getBytes()
The following examples show how to use
com.sun.org.apache.bcel.internal.classfile.ConstantUtf8#getBytes() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ClassElementValueGen.java From Bytecoder with Apache License 2.0 | 5 votes |
public String getClassString() { final ConstantUtf8 cu8 = (ConstantUtf8) getConstantPool().getConstant(idx); return cu8.getBytes(); // ConstantClass c = (ConstantClass)getConstantPool().getConstant(idx); // ConstantUtf8 utf8 = // (ConstantUtf8)getConstantPool().getConstant(c.getNameIndex()); // return utf8.getBytes(); }
Example 2
Source File: SimpleElementValueGen.java From Bytecoder with Apache License 2.0 | 5 votes |
public String getValueString() { if (super.getElementValueType() != STRING) { throw new RuntimeException( "Dont call getValueString() on a non STRING ElementValue"); } final ConstantUtf8 c = (ConstantUtf8) getConstantPool().getConstant(idx); return c.getBytes(); }
Example 3
Source File: SimpleElementValueGen.java From Bytecoder with Apache License 2.0 | 5 votes |
@Override public String stringifyValue() { switch (super.getElementValueType()) { case PRIMITIVE_INT: final ConstantInteger c = (ConstantInteger) getConstantPool().getConstant(idx); return Integer.toString(c.getBytes()); case PRIMITIVE_LONG: final ConstantLong j = (ConstantLong) getConstantPool().getConstant(idx); return Long.toString(j.getBytes()); case PRIMITIVE_DOUBLE: final ConstantDouble d = (ConstantDouble) getConstantPool().getConstant(idx); return Double.toString(d.getBytes()); case PRIMITIVE_FLOAT: final ConstantFloat f = (ConstantFloat) getConstantPool().getConstant(idx); return Float.toString(f.getBytes()); case PRIMITIVE_SHORT: final ConstantInteger s = (ConstantInteger) getConstantPool().getConstant(idx); return Integer.toString(s.getBytes()); case PRIMITIVE_BYTE: final ConstantInteger b = (ConstantInteger) getConstantPool().getConstant(idx); return Integer.toString(b.getBytes()); case PRIMITIVE_CHAR: final ConstantInteger ch = (ConstantInteger) getConstantPool().getConstant(idx); return Integer.toString(ch.getBytes()); case PRIMITIVE_BOOLEAN: final ConstantInteger bo = (ConstantInteger) getConstantPool().getConstant(idx); if (bo.getBytes() == 0) { return "false"; } return "true"; case STRING: final ConstantUtf8 cu8 = (ConstantUtf8) getConstantPool().getConstant(idx); return cu8.getBytes(); default: throw new RuntimeException( "SimpleElementValueGen class does not know how to stringify type " + super.getElementValueType()); } }
Example 4
Source File: EnumElementValueGen.java From Bytecoder with Apache License 2.0 | 5 votes |
@Override public String stringifyValue() { final ConstantUtf8 cu8 = (ConstantUtf8) getConstantPool().getConstant(valueIdx); return cu8.getBytes(); // ConstantString cu8 = // (ConstantString)getConstantPool().getConstant(valueIdx); // return // ((ConstantUtf8)getConstantPool().getConstant(cu8.getStringIndex())).getBytes(); }
Example 5
Source File: AnnotationEntryGen.java From Bytecoder with Apache License 2.0 | 4 votes |
public final String getTypeSignature() { // ConstantClass c = (ConstantClass)cpool.getConstant(typeIndex); final ConstantUtf8 utf8 = (ConstantUtf8) cpool .getConstant(typeIndex/* c.getNameIndex() */); return utf8.getBytes(); }