Ejemplo n.º 1
0
  public void load(XDataInput in) {
    newContext();
    try {
      magic = in.readInt();
      minor = in.readUnsignedShort();
      major = in.readUnsignedShort();

      pool = ConstantPool.create(true);

      pool.load(in, pool);

      flags = Flags.create(in, pool);
      classname = pool.getConstant(in.readUnsignedShort(), ClassRef.class);
      Log.debug("Loading class %s", classname.value());

      superclass = pool.getConstant(in.readUnsignedShort(), ClassRef.class);

      // interfaces
      {
        int count = in.readUnsignedShort();
        interfaces = new ArrayList<ClassRef>(count);
        while (count-- > 0) {
          ClassRef iface = pool.getConstant(in.readUnsignedShort(), ClassRef.class);
          interfaces.add(iface);
        }
      }

      // fields
      {
        int count = in.readUnsignedShort();
        fields = new ArrayList<FieldInfo>(count);
        while (count-- > 0) {
          FieldInfo f = new FieldInfo(this);
          f.load(in, pool);
          fields.add(f);
        }
      }

      // methods
      {
        int count = in.readUnsignedShort();
        methods = new ArrayList<MethodInfo>(count);
        while (count-- > 0) {
          MethodInfo m = new MethodInfo(this);
          m.load(in, pool);
          methods.add(m);
        }
      }

      attributes = AttributeHelper.loadAttributes(this, in);
      AttributeHelper.qdhRemoveUnsupportedAttributes(attributes);

      pool.close();

    } finally {
      closeContext();
    }
  }
Ejemplo n.º 2
0
  protected Task readConstantDataOrGetResolver(XDataInput in, ConstantPool pool) {
    readLength(in);

    int count = in.readUnsignedShort();
    items = new ArrayList<Item>(count);
    while (count-- > 0) {
      Item item = new Item();
      item.startpc = in.readUnsignedShort();
      item.length = in.readUnsignedShort();
      item.name = pool.getConstant(in.readUnsignedShort(), Utf8.class);
      item.signature = pool.getConstant(in.readUnsignedShort(), Utf8.class);
      items.add(item);
    }

    return null;
  }