Java Code Examples for org.apache.bcel.classfile.Utility#convertString()
The following examples show how to use
org.apache.bcel.classfile.Utility#convertString() .
These examples are extracted from open source projects.
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 Project: commons-bcel File: BCELFactory.java License: Apache License 2.0 | 6 votes |
private void createConstant( final Object value ) { String embed = value.toString(); if (value instanceof String) { embed = '"' + Utility.convertString(embed) + '"'; } else if (value instanceof Character) { embed = "(char)0x" + Integer.toHexString(((Character) value).charValue()); } else if (value instanceof Float) { embed += "f"; } else if (value instanceof Long) { embed += "L"; } else if (value instanceof ObjectType) { final ObjectType ot = (ObjectType) value; embed = "new ObjectType(\""+ot.getClassName()+"\")"; } _out.println("il.append(new PUSH(_cp, " + embed + "));"); }
Example 2
Source Project: ApkToolPlus File: BCELFactory.java License: Apache License 2.0 | 5 votes |
private void createConstant(Object value) { String embed = value.toString(); if(value instanceof String) embed = '"' + Utility.convertString(value.toString()) + '"'; else if(value instanceof Character) embed = "(char)0x" + Integer.toHexString(((Character)value).charValue()); _out.println("il.append(new PUSH(_cp, " + embed + "));"); }