com.judoscript.util.classfile
Class ClassFileUtil

java.lang.Object
  extended by com.judoscript.util.classfile.ClassFileUtil
All Implemented Interfaces:
ClassFileConsts

public class ClassFileUtil
extends java.lang.Object
implements ClassFileConsts


Field Summary
static java.util.Hashtable opcodeMap
           
 
Fields inherited from interface com.judoscript.util.classfile.ClassFileConsts
CONSTANT_Class, CONSTANT_Double, CONSTANT_Fieldref, CONSTANT_Float, CONSTANT_Integer, CONSTANT_InterfaceMethodref, CONSTANT_Long, CONSTANT_Methodref, CONSTANT_NameAndType, CONSTANT_Names, CONSTANT_String, CONSTANT_Utf8, instructions, M_CLS, M_CLSVAL, M_FLD, M_IFS, M_ITF, M_JMP, M_LOD, M_MTD, M_NON, M_TYP, M_UNK, M_VAL, M_VAR, M_VARVAL, MAJOR, MINOR, OPCODE_aaload, OPCODE_aastore, OPCODE_aconst_null, OPCODE_aload, OPCODE_aload_0, OPCODE_aload_1, OPCODE_aload_2, OPCODE_aload_3, OPCODE_anewarray, OPCODE_anewarray_quick, OPCODE_areturn, OPCODE_arraylength, OPCODE_astore, OPCODE_astore_0, OPCODE_astore_1, OPCODE_astore_2, OPCODE_astore_3, OPCODE_athrow, OPCODE_baload, OPCODE_bastore, OPCODE_bipush, OPCODE_breakpoint, OPCODE_caload, OPCODE_castore, OPCODE_checkcast, OPCODE_checkcast_quick, OPCODE_d2f, OPCODE_d2i, OPCODE_d2l, OPCODE_dadd, OPCODE_daload, OPCODE_dastore, OPCODE_dcmpg, OPCODE_dcmpl, OPCODE_dconst_0, OPCODE_dconst_1, OPCODE_ddiv, OPCODE_dload, OPCODE_dload_0, OPCODE_dload_1, OPCODE_dload_2, OPCODE_dload_3, OPCODE_dmul, OPCODE_dneg, OPCODE_drem, OPCODE_dreturn, OPCODE_dstore, OPCODE_dstore_0, OPCODE_dstore_1, OPCODE_dstore_2, OPCODE_dstore_3, OPCODE_dsub, OPCODE_dup, OPCODE_dup_x1, OPCODE_dup_x2, OPCODE_dup2, OPCODE_dup2_x1, OPCODE_dup2_x2, OPCODE_f2d, OPCODE_f2i, OPCODE_f2l, OPCODE_fadd, OPCODE_faload, OPCODE_fastore, OPCODE_fcmpg, OPCODE_fcmpl, OPCODE_fconst_0, OPCODE_fconst_1, OPCODE_fconst_2, OPCODE_fdiv, OPCODE_fload, OPCODE_fload_0, OPCODE_fload_1, OPCODE_fload_2, OPCODE_fload_3, OPCODE_fmul, OPCODE_fneg, OPCODE_frem, OPCODE_freturn, OPCODE_fstore, OPCODE_fstore_0, OPCODE_fstore_1, OPCODE_fstore_2, OPCODE_fstore_3, OPCODE_fsub, OPCODE_getfield, OPCODE_getfield_quick, OPCODE_getfield_quick_w, OPCODE_getfield2_quick, OPCODE_getstatic, OPCODE_getstatic_quick, OPCODE_getstatic2_quick, OPCODE_goto, OPCODE_goto_w, OPCODE_i2b, OPCODE_i2c, OPCODE_i2d, OPCODE_i2f, OPCODE_i2l, OPCODE_i2s, OPCODE_iadd, OPCODE_iaload, OPCODE_iand, OPCODE_iastore, OPCODE_iconst_0, OPCODE_iconst_1, OPCODE_iconst_2, OPCODE_iconst_3, OPCODE_iconst_4, OPCODE_iconst_5, OPCODE_iconst_m1, OPCODE_idiv, OPCODE_if_acmpeq, OPCODE_if_acmpne, OPCODE_if_icmpeq, OPCODE_if_icmpge, OPCODE_if_icmpgt, OPCODE_if_icmple, OPCODE_if_icmplt, OPCODE_if_icmpne, OPCODE_ifeq, OPCODE_ifge, OPCODE_ifgt, OPCODE_ifle, OPCODE_iflt, OPCODE_ifne, OPCODE_ifnonnull, OPCODE_ifnull, OPCODE_iinc, OPCODE_iload, OPCODE_iload_0, OPCODE_iload_1, OPCODE_iload_2, OPCODE_iload_3, OPCODE_impdep1, OPCODE_impdep2, OPCODE_imul, OPCODE_ineg, OPCODE_instanceof, OPCODE_instanceof_quick, OPCODE_invokeinterface, OPCODE_invokeinterface_quick, OPCODE_invokenonvirtual_quick, OPCODE_invokespecial, OPCODE_invokestatic, OPCODE_invokestatic_quick, OPCODE_invokesuper_quick, OPCODE_invokevirtual, OPCODE_invokevirtual_quick, OPCODE_invokevirtual_quick_w, OPCODE_invokevirtualobject_quick, OPCODE_ior, OPCODE_irem, OPCODE_ireturn, OPCODE_ishl, OPCODE_ishr, OPCODE_istore, OPCODE_istore_0, OPCODE_istore_1, OPCODE_istore_2, OPCODE_istore_3, OPCODE_isub, OPCODE_iushr, OPCODE_ixor, OPCODE_jsr, OPCODE_jsr_w, OPCODE_l2d, OPCODE_l2f, OPCODE_l2i, OPCODE_ladd, OPCODE_laload, OPCODE_land, OPCODE_lastore, OPCODE_lcmp, OPCODE_lconst_0, OPCODE_lconst_1, OPCODE_ldc, OPCODE_ldc_quick, OPCODE_ldc_w, OPCODE_ldc_w_quick, OPCODE_ldc2_w, OPCODE_ldc2_w_quick, OPCODE_ldiv, OPCODE_lload, OPCODE_lload_0, OPCODE_lload_1, OPCODE_lload_2, OPCODE_lload_3, OPCODE_lmul, OPCODE_lneg, OPCODE_lookupswitch, OPCODE_lor, OPCODE_lrem, OPCODE_lreturn, OPCODE_lshl, OPCODE_lshr, OPCODE_lstore, OPCODE_lstore_0, OPCODE_lstore_1, OPCODE_lstore_2, OPCODE_lstore_3, OPCODE_lsub, OPCODE_lushr, OPCODE_lxor, OPCODE_monitorenter, OPCODE_monitorexit, OPCODE_multianewarray, OPCODE_multianewarray_quick, OPCODE_new, OPCODE_new_quick, OPCODE_newarray, OPCODE_nop, OPCODE_pop, OPCODE_pop2, OPCODE_putfield, OPCODE_putfield_quick, OPCODE_putfield_quick_w, OPCODE_putfield2_quick, OPCODE_putstatic, OPCODE_putstatic_quick, OPCODE_putstatic2_quick, OPCODE_ret, OPCODE_return, OPCODE_saload, OPCODE_sastore, OPCODE_sipush, OPCODE_swap, OPCODE_tableswitch, OPCODE_wide, OPTYPES_NONE, OPTYPES_S2, OPTYPES_S4, OPTYPES_U1, OPTYPES_U1U1, OPTYPES_U2, OPTYPES_U2U1, OPTYPES_U2U1U1, T_S1, T_S2, T_S4, T_U1, T_U2, T_U4, UNDEFINED, UNK, UNKNOWN
 
Constructor Summary
ClassFileUtil()
           
 
Method Summary
static int[] checkCode(byte[] code)
           
static java.lang.String getAccessFlagNames(int flags)
           
static int getAccessFlags(java.lang.String accessNames)
           
static java.lang.String getHtmlRefCP(int i)
           
static java.lang.String getInst(byte[] code, int addr)
           
static int[] getInvokeStackSizes(java.lang.Class retType, java.lang.Class[] params)
           
static int[] getInvokeStackSizes(java.lang.String desc)
           
static int getOpcode(java.lang.String mnemonic)
           
static short getS2(byte[] data, int idx)
           
static int getS4(byte[] data, int idx)
           
static long getS8(byte[] data, int idx)
           
static int getU1(byte[] data, int idx)
           
static int getU2(byte[] data, int idx)
           
static int getUtf8Length(java.lang.String s)
           
static java.lang.String getVMMethodSig(java.lang.Class retType, java.lang.Class[] params)
           
static java.lang.String getVMMethodSig(java.lang.reflect.Method m)
           
static java.lang.String getVMTypeName(java.lang.Class c)
           
static int getVMTypeSize(java.lang.Class c)
           
static byte[] parseMethodSig(java.lang.String desc)
           
static void printAttrsHtml(java.io.PrintWriter out, Attr[] attrs)
           
static void putS2(byte[] data, int idx, int val)
           
static void putS4(byte[] data, int idx, int val)
           
static void putS8(byte[] data, int idx, long val)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

opcodeMap

public static final java.util.Hashtable opcodeMap
Constructor Detail

ClassFileUtil

public ClassFileUtil()
Method Detail

getOpcode

public static int getOpcode(java.lang.String mnemonic)

getAccessFlagNames

public static java.lang.String getAccessFlagNames(int flags)

getAccessFlags

public static int getAccessFlags(java.lang.String accessNames)

checkCode

public static int[] checkCode(byte[] code)
                       throws BadClassFormatException
Throws:
BadClassFormatException

getInst

public static java.lang.String getInst(byte[] code,
                                       int addr)
                                throws BadClassFormatException
Throws:
BadClassFormatException

putS2

public static void putS2(byte[] data,
                         int idx,
                         int val)

putS4

public static void putS4(byte[] data,
                         int idx,
                         int val)

putS8

public static void putS8(byte[] data,
                         int idx,
                         long val)

getU1

public static int getU1(byte[] data,
                        int idx)

getU2

public static int getU2(byte[] data,
                        int idx)

getS4

public static int getS4(byte[] data,
                        int idx)

getS8

public static long getS8(byte[] data,
                         int idx)

getS2

public static short getS2(byte[] data,
                          int idx)

getUtf8Length

public static int getUtf8Length(java.lang.String s)

getHtmlRefCP

public static java.lang.String getHtmlRefCP(int i)

printAttrsHtml

public static void printAttrsHtml(java.io.PrintWriter out,
                                  Attr[] attrs)
                           throws java.io.IOException
Throws:
java.io.IOException

getInvokeStackSizes

public static int[] getInvokeStackSizes(java.lang.String desc)
                                 throws BadClassFormatException
Throws:
BadClassFormatException

parseMethodSig

public static byte[] parseMethodSig(java.lang.String desc)
                             throws BadClassFormatException
Throws:
BadClassFormatException

getInvokeStackSizes

public static int[] getInvokeStackSizes(java.lang.Class retType,
                                        java.lang.Class[] params)

getVMTypeSize

public static int getVMTypeSize(java.lang.Class c)

getVMTypeName

public static java.lang.String getVMTypeName(java.lang.Class c)

getVMMethodSig

public static java.lang.String getVMMethodSig(java.lang.reflect.Method m)

getVMMethodSig

public static java.lang.String getVMMethodSig(java.lang.Class retType,
                                              java.lang.Class[] params)