Ejemplo n.º 1
0
 public static CP_INFO loadConstant(ClazzInputStream cis, Clazz clazz)
     throws ClazzException, IOException {
   CP_INFO cp_info;
   int tag = cis.readU1();
   switch (tag) {
     case CONSTANT_Class:
       cp_info = new CONSTANT_Class_info();
       break;
     case CONSTANT_Fieldref:
       cp_info = new CONSTANT_Fieldref_info();
       break;
     case CONSTANT_Methodref:
       cp_info = new CONSTANT_Methodref_info();
       break;
     case CONSTANT_InterfaceMethodref:
       cp_info = new CONSTANT_InterfaceMethodref_info();
       break;
     case CONSTANT_String:
       cp_info = new CONSTANT_String_info();
       break;
     case CONSTANT_Integer:
       cp_info = new CONSTANT_Integer_info();
       break;
     case CONSTANT_Float:
       cp_info = new CONSTANT_Float_info();
       break;
     case CONSTANT_Long:
       cp_info = new CONSTANT_Long_info();
       break;
     case CONSTANT_Double:
       cp_info = new CONSTANT_Double_info();
       break;
     case CONSTANT_NameAndType:
       cp_info = new CONSTANT_NameAndType_info();
       break;
     case CONSTANT_Utf8:
       cp_info = new CONSTANT_Utf8_info();
       break;
     default:
       throw new ClazzException("Invalid constant type " + tag);
   }
   cp_info.load(cis, clazz);
   return cp_info;
 }
  public void load(ClazzInputStream cis) throws IOException, ClazzException {
    attributeLength = (int) cis.readU4();

    int local_variable_table_type_length = cis.readU2();
    local_variable_type_table = new LocalSignedVariable[local_variable_table_type_length];
    for (int i = 0; i < local_variable_table_type_length; i++) {
      local_variable_type_table[i] = new LocalSignedVariable();
      local_variable_type_table[i].start_pc = cis.readU2();
      local_variable_type_table[i].length = cis.readU2();
      int name_index = cis.readU2();
      local_variable_type_table[i].name = (CONSTANT_Utf8) clazz.getConstant_pool()[name_index];
      int signature_index = cis.readU2();
      local_variable_type_table[i].signature =
          (CONSTANT_Utf8) clazz.getConstant_pool()[signature_index];
      local_variable_type_table[i].index = cis.readU2();
    }
  }
Ejemplo n.º 3
0
  public void load(ClazzInputStream cis, Clazz clazz) throws IOException, ClazzException {
    cis.readU4(); // attribute length

    signature = ((CONSTANT_Utf8_info) clazz.getConstant_pool()[cis.readU2()]).getString();
  }