private AnnotationsList readAnnotationSet(int offset) throws DecodeException { if (offset == 0) { return AnnotationsList.EMPTY; } Section section = dex.openSection(offset); int size = section.readInt(); if (size == 0) { return AnnotationsList.EMPTY; } List<Annotation> list = new ArrayList<>(size); for (int i = 0; i < size; i++) { Section anSection = dex.openSection(section.readInt()); Annotation a = readAnnotation(dex, anSection, true); list.add(a); } return new AnnotationsList(list); }
public void parse(int offset) throws DecodeException { Section section = dex.openSection(offset); // TODO read as unsigned int int classAnnotationsOffset = section.readInt(); int fieldsCount = section.readInt(); int annotatedMethodsCount = section.readInt(); int annotatedParametersCount = section.readInt(); if (classAnnotationsOffset != 0) { cls.addAttr(readAnnotationSet(classAnnotationsOffset)); } for (int i = 0; i < fieldsCount; i++) { FieldNode f = cls.searchFieldById(section.readInt()); f.addAttr(readAnnotationSet(section.readInt())); } for (int i = 0; i < annotatedMethodsCount; i++) { MethodNode m = cls.searchMethodById(section.readInt()); m.addAttr(readAnnotationSet(section.readInt())); } for (int i = 0; i < annotatedParametersCount; i++) { MethodNode mth = cls.searchMethodById(section.readInt()); // read annotation ref list Section ss = dex.openSection(section.readInt()); int size = ss.readInt(); MethodParameters params = new MethodParameters(size); for (int j = 0; j < size; j++) { params.getParamList().add(readAnnotationSet(ss.readInt())); } mth.addAttr(params); } }
public FieldId readFieldId() { int declaringClassIndex = readUnsignedShort(); int typeIndex = readUnsignedShort(); int nameIndex = readInt(); return new FieldId(Dex.this, declaringClassIndex, typeIndex, nameIndex); }
public FieldId readFieldId() { int declaringClassIndex = readUnsignedShort(); int typeIndex = readUnsignedShort(); int nameIndex = readInt(); return new FieldId(Dex.this, declaringClassIndex, typeIndex, nameIndex); }
public CallSiteId readCallSiteId() { int offset = readInt(); return new CallSiteId(Dex.this, offset); }
@Override Integer read(Dex.Section in, IndexMap indexMap, int index) { int stringIndex = in.readInt(); return indexMap.adjustString(stringIndex); }
private Try[] readTries(int triesSize, CatchHandler[] catchHandlers) { Try[] result = new Try[triesSize]; for (int i = 0; i < triesSize; i++) { int startAddress = readInt(); int instructionCount = readUnsignedShort(); int handlerOffset = readUnsignedShort(); int catchHandlerIndex = findCatchHandlerIndex(catchHandlers, handlerOffset); result[i] = new Try(startAddress, instructionCount, catchHandlerIndex); } return result; }
public MethodId readMethodId() { int declaringClassIndex = readUnsignedShort(); int protoIndex = readUnsignedShort(); int nameIndex = readInt(); return new MethodId(Dex.this, declaringClassIndex, protoIndex, nameIndex); }
public ClassDef readClassDef() { int offset = getPosition(); int type = readInt(); int accessFlags = readInt(); int supertype = readInt(); int interfacesOffset = readInt(); int sourceFileIndex = readInt(); int annotationsOffset = readInt(); int classDataOffset = readInt(); int staticValuesOffset = readInt(); return new ClassDef(Dex.this, offset, type, accessFlags, supertype, interfacesOffset, sourceFileIndex, annotationsOffset, classDataOffset, staticValuesOffset); }
public MethodId readMethodId() { int declaringClassIndex = readUnsignedShort(); int protoIndex = readUnsignedShort(); int nameIndex = readInt(); return new MethodId(Dex.this, declaringClassIndex, protoIndex, nameIndex); }
private Try[] readTries(int triesSize, CatchHandler[] catchHandlers) { Try[] result = new Try[triesSize]; for (int i = 0; i < triesSize; i++) { int startAddress = readInt(); int instructionCount = readUnsignedShort(); int handlerOffset = readUnsignedShort(); int catchHandlerIndex = findCatchHandlerIndex(catchHandlers, handlerOffset); result[i] = new Try(startAddress, instructionCount, catchHandlerIndex); } return result; }
public MethodId readMethodId() { int declaringClassIndex = readUnsignedShort(); int protoIndex = readUnsignedShort(); int nameIndex = readInt(); return new MethodId(Dex.this, declaringClassIndex, protoIndex, nameIndex); }
public TypeList readTypeList() { int size = readInt(); short[] types = readShortArray(size); alignToFourBytes(); return new TypeList(Dex.this, types); }
@Override Integer read(Dex.Section in, IndexMap indexMap, int index) { int stringIndex = in.readInt(); return indexMap.adjustString(stringIndex); }
private Try[] readTries(int triesSize, CatchHandler[] catchHandlers) { Try[] result = new Try[triesSize]; for (int i = 0; i < triesSize; i++) { int startAddress = readInt(); int instructionCount = readUnsignedShort(); int handlerOffset = readUnsignedShort(); int catchHandlerIndex = findCatchHandlerIndex(catchHandlers, handlerOffset); result[i] = new Try(startAddress, instructionCount, catchHandlerIndex); } return result; }
public FieldId readFieldId() { int declaringClassIndex = readUnsignedShort(); int typeIndex = readUnsignedShort(); int nameIndex = readInt(); return new FieldId(Dex.this, declaringClassIndex, typeIndex, nameIndex); }
public TypeList readTypeList() { int size = readInt(); short[] types = readShortArray(size); alignToFourBytes(); return new TypeList(Dex.this, types); }