private ConstantInfo getConstant(int index) { try { return mCp.getConstant(index); } catch (IndexOutOfBoundsException e) { return null; } }
public EnumConstValue(ConstantPool cp, DataInput din) throws IOException { mTypeName = (ConstantUTFInfo)cp.getConstant(din.readUnsignedShort()); mConstName = (ConstantUTFInfo)cp.getConstant(din.readUnsignedShort()); }
public EnclosingMethodAttr(ConstantPool cp, String name, int length, DataInput din) throws IOException { super(cp, name); mClass = (ConstantClassInfo)cp.getConstant(din.readUnsignedShort()); mMethod = (ConstantNameAndTypeInfo)cp.getConstant(din.readUnsignedShort()); if ((length -= 4) > 0) { din.skipBytes(length); } }
ObjectVariableInfo(ConstantPool cp, DataInput din) throws IOException { mClassInfo = (ConstantClassInfo) cp.getConstant(din.readUnsignedShort()); }
public SignatureAttr(ConstantPool cp, String name, int length, DataInput din) throws IOException { super(cp, name); int index = din.readUnsignedShort(); if ((length -= 2) > 0) { din.skipBytes(length); } mSignature = (ConstantUTFInfo) cp.getConstant(index); }
public ConstantValueAttr(ConstantPool cp, String name, int length, DataInput din) throws IOException { super(cp, name); int index = din.readUnsignedShort(); if ((length -= 2) > 0) { din.skipBytes(length); } mConstant = cp.getConstant(index); }
public SourceFileAttr(ConstantPool cp, String name, int length, DataInput din) throws IOException { super(cp, name); int index = din.readUnsignedShort(); if ((length -= 2) > 0) { din.skipBytes(length); } mSourcefile = (ConstantUTFInfo)cp.getConstant(index); }
public Annotation(ConstantPool cp, DataInput din) throws IOException { mCp = cp; mType = (ConstantUTFInfo)cp.getConstant(din.readUnsignedShort()); int memberCount = din.readUnsignedShort(); mMemberValues = new LinkedHashMap<String, MemberValue>(memberCount); for (int i=0; i<memberCount; i++) { String name = ((ConstantUTFInfo)cp.getConstant(din.readUnsignedShort())).getValue(); mMemberValues.put(name, new MemberValue(cp, din)); } }
public ExceptionsAttr(ConstantPool cp, String name, int length, DataInput din) throws IOException { super(cp, name); int size = din.readUnsignedShort(); length -= 2; for (int i=0; i<size; i++) { int index = din.readUnsignedShort(); length -= 2; ConstantClassInfo info = (ConstantClassInfo)cp.getConstant(index); addException(info); } if (length > 0) { din.skipBytes(length); } }
inner = null; } else { inner = (ConstantClassInfo)cp.getConstant(inner_index); outer = null; } else { outer = (ConstantClassInfo)cp.getConstant(outer_index); innerName = null; } else { innerName = (ConstantUTFInfo)cp.getConstant(name_index);
static FieldInfo readFrom(ClassFile parent, DataInput din, AttributeFactory attrFactory) throws IOException { ConstantPool cp = parent.getConstantPool(); int modifier = din.readUnsignedShort(); int index = din.readUnsignedShort(); ConstantUTFInfo nameConstant = (ConstantUTFInfo)cp.getConstant(index); index = din.readUnsignedShort(); ConstantUTFInfo descConstant = (ConstantUTFInfo)cp.getConstant(index); FieldInfo info = new FieldInfo(parent, modifier, nameConstant, descConstant); // Read attributes. int size = din.readUnsignedShort(); for (int i=0; i<size; i++) { info.addAttribute(Attribute.readFrom(cp, din, attrFactory)); } return info; } }
static MethodInfo readFrom(ClassFile parent, DataInput din, AttributeFactory attrFactory) throws IOException { ConstantPool cp = parent.getConstantPool(); int modifier = din.readUnsignedShort(); int index = din.readUnsignedShort(); ConstantUTFInfo nameConstant = (ConstantUTFInfo)cp.getConstant(index); index = din.readUnsignedShort(); ConstantUTFInfo descConstant = (ConstantUTFInfo)cp.getConstant(index); MethodInfo info = new MethodInfo(parent, modifier, nameConstant, descConstant); // Read attributes. int size = din.readUnsignedShort(); for (int i=0; i<size; i++) { info.addAttribute(Attribute.readFrom(cp, din, attrFactory)); } return info; } }
/** * @param attrFactory optional factory for reading custom attributes */ public static Attribute readFrom(ConstantPool cp, DataInput din, AttributeFactory attrFactory) throws IOException { int index = din.readUnsignedShort(); String name = ((ConstantUTFInfo)cp.getConstant(index)).getValue(); int length = din.readInt(); attrFactory = new Factory(attrFactory); return attrFactory.createAttribute(cp, name, length, din); }
case MEMBER_TAG_CLASS: case MEMBER_TAG_STRING: mValue = cp.getConstant(din.readUnsignedShort()); break;
public static ExceptionHandler<FixedLocation> readFrom(ConstantPool cp, DataInput din) throws IOException { int start_pc = din.readUnsignedShort(); int end_pc = din.readUnsignedShort(); int handler_pc = din.readUnsignedShort(); int catch_type = din.readUnsignedShort(); ConstantClassInfo catchTypeConstant; if (catch_type == 0) { catchTypeConstant = null; } else { catchTypeConstant = (ConstantClassInfo)cp.getConstant(catch_type); } return new ExceptionHandler<FixedLocation>(new FixedLocation(start_pc), new FixedLocation(end_pc), new FixedLocation(handler_pc), catchTypeConstant); } }
final int index = din.readUnsignedShort(); final ConstantUTFInfo varName = (ConstantUTFInfo)cp.getConstant(name_index); final ConstantUTFInfo varDesc = (ConstantUTFInfo)cp.getConstant(descriptor_index);
ConstantClassInfo thisClass = (ConstantClassInfo)cp.getConstant(index); superClass = (ConstantClassInfo)cp.getConstant(index); for (int i=0; i<size; i++) { index = din.readUnsignedShort(); ConstantClassInfo info = (ConstantClassInfo)cp.getConstant(index); cf.addInterface(info.getType().getRootName());
public SourceFileAttr(ConstantPool cp, String name, int length, DataInput din) throws IOException { super(cp, name); int index = din.readUnsignedShort(); skipBytes(din, length - 2); mSourcefile = (ConstantUTFInfo)cp.getConstant(index); }
public ConstantValueAttr(ConstantPool cp, String name, int length, DataInput din) throws IOException { super(cp, name); int index = din.readUnsignedShort(); skipBytes(din, length - 2); mConstant = cp.getConstant(index); }
ci = mCp.getConstant(index); } catch (IndexOutOfBoundsException e) { error(opcode, "Undefined constant at index: " + index); index = readUnsignedShort(); try { ci = mCp.getConstant(index); } catch (IndexOutOfBoundsException e) { error(opcode, "Undefined constant at index: " + index); index = readUnsignedShort(); try { ci = mCp.getConstant(index); } catch (IndexOutOfBoundsException e) { error(opcode, "Undefined constant at index: " + index); index = readUnsignedShort(); try { ci = mCp.getConstant(index); } catch (IndexOutOfBoundsException e) { error(opcode, "Undefined constant at index: " + index); index = readUnsignedShort(); try { ci = mCp.getConstant(index); } catch (IndexOutOfBoundsException e) { error(opcode, "Undefined constant at index: " + index); index = readUnsignedShort();