public int getMethodHandleCount() { MapItem mapItem = getMapItemForSection(ItemType.METHOD_HANDLE_ITEM); if (mapItem == null) { return 0; } return mapItem.getItemCount(); }
@Nullable public MapItem getMapItemForSection(int itemType) { for (MapItem mapItem: getMapItems()) { if (mapItem.getType() == itemType) { return mapItem; } } return null; }
@Override public MapItem readItem(int index) { int mapItemOffset = mapOffset + 4 + index * MapItem.ITEM_SIZE; return new MapItem(DexBackedDexFile.this, mapItemOffset); }
public int getCallSiteIdItemOffset(int callSiteIndex) { MapItem mapItem = getMapItemForSection(ItemType.CALL_SITE_ID_ITEM); if (mapItem == null || callSiteIndex >= mapItem.getItemCount()) { throw new InvalidItemIndex(callSiteIndex, "Call site index out of bounds: %d", callSiteIndex); } return mapItem.getOffset() + callSiteIndex * CallSiteIdItem.ITEM_SIZE; }
public SectionAnnotator(@Nonnull DexAnnotator annotator, @Nonnull MapItem mapItem) { this.annotator = annotator; this.dexFile = annotator.dexFile; this.itemType = mapItem.getType(); this.sectionOffset = mapItem.getOffset(); this.itemCount = mapItem.getItemCount(); }
List<MapItem> mapItems2 = dexFile2.getMapItems(); for (int i=0; i<mapItems1.size(); i++) { Assert.assertEquals(mapItems1.get(i).getType(), mapItems2.get(i).getType()); Assert.assertEquals(mapItems1.get(i).getItemCount(), mapItems2.get(i).getItemCount());
switch (mapItem.getType()) { case ItemType.HEADER_ITEM: annotators.put(mapItem.getType(), HeaderItem.makeAnnotator(this, mapItem)); break; case ItemType.STRING_ID_ITEM: annotators.put(mapItem.getType(), StringIdItem.makeAnnotator(this, mapItem)); break; case ItemType.TYPE_ID_ITEM: annotators.put(mapItem.getType(), TypeIdItem.makeAnnotator(this, mapItem)); break; case ItemType.PROTO_ID_ITEM: annotators.put(mapItem.getType(), ProtoIdItem.makeAnnotator(this, mapItem)); break; case ItemType.FIELD_ID_ITEM: annotators.put(mapItem.getType(), FieldIdItem.makeAnnotator(this, mapItem)); break; case ItemType.METHOD_ID_ITEM: annotators.put(mapItem.getType(), MethodIdItem.makeAnnotator(this, mapItem)); break; case ItemType.CLASS_DEF_ITEM: annotators.put(mapItem.getType(), ClassDefItem.makeAnnotator(this, mapItem)); break; case ItemType.MAP_LIST: annotators.put(mapItem.getType(), MapItem.makeAnnotator(this, mapItem)); break; case ItemType.TYPE_LIST: annotators.put(mapItem.getType(), TypeListItem.makeAnnotator(this, mapItem)); break; case ItemType.ANNOTATION_SET_REF_LIST:
public SectionAnnotator(@Nonnull DexAnnotator annotator, @Nonnull MapItem mapItem) { this.annotator = annotator; this.dexFile = annotator.dexFile; this.itemType = mapItem.getType(); this.sectionOffset = mapItem.getOffset(); this.itemCount = mapItem.getItemCount(); }
public int getMethodHandleItemOffset(int methodHandleIndex) { MapItem mapItem = getMapItemForSection(ItemType.METHOD_HANDLE_ITEM); if (mapItem == null || methodHandleIndex >= mapItem.getItemCount()) { throw new InvalidItemIndex(methodHandleIndex , "Method handle index out of bounds: %d", methodHandleIndex); } return mapItem.getOffset() + methodHandleIndex * MethodHandleItem.ITEM_SIZE; }
switch (mapItem.getType()) { case ItemType.HEADER_ITEM: annotators.put(mapItem.getType(), HeaderItem.makeAnnotator(this, mapItem)); break; case ItemType.STRING_ID_ITEM: annotators.put(mapItem.getType(), StringIdItem.makeAnnotator(this, mapItem)); break; case ItemType.TYPE_ID_ITEM: annotators.put(mapItem.getType(), TypeIdItem.makeAnnotator(this, mapItem)); break; case ItemType.PROTO_ID_ITEM: annotators.put(mapItem.getType(), ProtoIdItem.makeAnnotator(this, mapItem)); break; case ItemType.FIELD_ID_ITEM: annotators.put(mapItem.getType(), FieldIdItem.makeAnnotator(this, mapItem)); break; case ItemType.METHOD_ID_ITEM: annotators.put(mapItem.getType(), MethodIdItem.makeAnnotator(this, mapItem)); break; case ItemType.CLASS_DEF_ITEM: annotators.put(mapItem.getType(), ClassDefItem.makeAnnotator(this, mapItem)); break; case ItemType.MAP_LIST: annotators.put(mapItem.getType(), MapItem.makeAnnotator(this, mapItem)); break; case ItemType.TYPE_LIST: annotators.put(mapItem.getType(), TypeListItem.makeAnnotator(this, mapItem)); break; case ItemType.ANNOTATION_SET_REF_LIST:
public int getCallSiteCount() { MapItem mapItem = getMapItemForSection(ItemType.CALL_SITE_ID_ITEM); if (mapItem == null) { return 0; } return mapItem.getItemCount(); }
public SectionAnnotator(@Nonnull DexAnnotator annotator, @Nonnull MapItem mapItem) { this.annotator = annotator; this.dexFile = annotator.dexFile; this.itemType = mapItem.getType(); this.sectionOffset = mapItem.getOffset(); this.itemCount = mapItem.getItemCount(); }
public int getCallSiteIdItemOffset(int callSiteIndex) { MapItem mapItem = getMapItemForSection(ItemType.CALL_SITE_ID_ITEM); if (mapItem == null || callSiteIndex >= mapItem.getItemCount()) { throw new InvalidItemIndex(callSiteIndex, "Call site index out of bounds: %d", callSiteIndex); } return mapItem.getOffset() + callSiteIndex * CallSiteIdItem.ITEM_SIZE; }
@Nonnull public String getName() { return ItemType.getItemTypeName(getType()); }
switch (mapItem.getType()) { case ItemType.HEADER_ITEM: annotators.put(mapItem.getType(), HeaderItem.makeAnnotator(this, mapItem)); break; case ItemType.STRING_ID_ITEM: annotators.put(mapItem.getType(), StringIdItem.makeAnnotator(this, mapItem)); break; case ItemType.TYPE_ID_ITEM: annotators.put(mapItem.getType(), TypeIdItem.makeAnnotator(this, mapItem)); break; case ItemType.PROTO_ID_ITEM: annotators.put(mapItem.getType(), ProtoIdItem.makeAnnotator(this, mapItem)); break; case ItemType.FIELD_ID_ITEM: annotators.put(mapItem.getType(), FieldIdItem.makeAnnotator(this, mapItem)); break; case ItemType.METHOD_ID_ITEM: annotators.put(mapItem.getType(), MethodIdItem.makeAnnotator(this, mapItem)); break; case ItemType.CLASS_DEF_ITEM: annotators.put(mapItem.getType(), ClassDefItem.makeAnnotator(this, mapItem)); break; case ItemType.MAP_LIST: annotators.put(mapItem.getType(), MapItem.makeAnnotator(this, mapItem)); break; case ItemType.TYPE_LIST: annotators.put(mapItem.getType(), TypeListItem.makeAnnotator(this, mapItem)); break; case ItemType.ANNOTATION_SET_REF_LIST:
@Override public MapItem readItem(int index) { int mapItemOffset = mapOffset + 4 + index * MapItem.ITEM_SIZE; return new MapItem(DexBackedDexFile.this, mapItemOffset); }
public static String[] getStrings(@Nonnull RawDexFile dexFile) { MapItem mapItem = dexFile.getMapItemForSection(ItemType.STRING_ID_ITEM); if (mapItem == null) { return new String[0]; } int stringCount = mapItem.getItemCount(); String[] ret = new String[stringCount]; for (int i=0; i<stringCount; i++) { ret[i] = dexFile.getString(i); } return ret; } }
public int getMethodHandleItemOffset(int methodHandleIndex) { MapItem mapItem = getMapItemForSection(ItemType.METHOD_HANDLE_ITEM); if (mapItem == null || methodHandleIndex >= mapItem.getItemCount()) { throw new InvalidItemIndex(methodHandleIndex , "Method handle index out of bounds: %d", methodHandleIndex); } return mapItem.getOffset() + methodHandleIndex * MethodHandleItem.ITEM_SIZE; }
@Override public MapItem readItem(int index) { int mapItemOffset = mapOffset + 4 + index * MapItem.ITEM_SIZE; return new MapItem(RawDexFile.this, mapItemOffset); }