public int placeAt(int offset) { if (DexFile.this.getInplace()) { return super.placeAt(offset); } int ret = ClassDefItem.placeClassDefItems(this, offset); Collections.sort(this.items, new Comparator<ClassDefItem>() { public int compare(ClassDefItem a, ClassDefItem b) { return a.getOffset() - b.getOffset(); } }); this.offset = items.get(0).getOffset(); return ret; } };
/** * Finalize the location of all items, and place them starting at the given offset * @param offset The offset where this section should be placed * @return the offset of the byte immediate after the last item in this section */ protected int placeAt(int offset) { if (items.size() > 0) { offset = AlignmentUtils.alignOffset(offset, ItemType.ItemAlignment); assert !DexFile.getInplace() || offset == this.offset; this.offset = offset; for (int i=0; i < items.size(); i++) { T item = items.get(i); assert item != null; offset = AlignmentUtils.alignOffset(offset, ItemType.ItemAlignment); offset = item.placeAt(offset, i); } } else { this.offset = 0; } return offset; }
List<StaticFieldInitializer> staticFieldInitializers) { EncodedArrayItem encodedArrayItem = null; if(!dexFile.getInplace() && staticFieldInitializers != null && staticFieldInitializers.size() > 0) { assert classData != null; assert staticFieldInitializers.size() == classData.getStaticFields().length;
List<StaticFieldInitializer> staticFieldInitializers) { EncodedArrayItem encodedArrayItem = null; if(!dexFile.getInplace() && staticFieldInitializers != null && staticFieldInitializers.size() > 0) { assert classData != null; assert staticFieldInitializers.size() == classData.getStaticFields().length;
/** * Place the item at the given offset and index, and return the offset of the byte following this item * @param offset The offset to place the item at * @param index The index of the item within the containing section * @return The offset of the byte following this item */ protected int placeAt(int offset, int index) { try { assert AlignmentUtils.isAligned(offset, getItemType().ItemAlignment); assert !dexFile.getInplace() || (offset == this.offset && this.index == index); this.offset = offset; this.index = index; return this.placeItem(offset); } catch (Exception ex) { throw addExceptionContext(ex); } }
public int placeAt(int offset) { if (DexFile.this.getInplace()) { return super.placeAt(offset); } int ret = ClassDefItem.placeClassDefItems(this, offset); Collections.sort(this.items); this.offset = items.get(0).getOffset(); return ret; }
/** * Finalize the location of all items, and place them starting at the given offset * @param offset The offset where this section should be placed * @return the offset of the byte immediate after the last item in this section */ protected int placeAt(int offset) { if (items.size() > 0) { offset = AlignmentUtils.alignOffset(offset, ItemType.ItemAlignment); assert !DexFile.getInplace() || offset == this.offset; this.offset = offset; for (int i=0; i < items.size(); i++) { T item = items.get(i); assert item != null; offset = AlignmentUtils.alignOffset(offset, ItemType.ItemAlignment); offset = item.placeAt(offset, i); } } else { this.offset = 0; } return offset; }
@Nullable List<StaticFieldInitializer> staticFieldInitializers) { EncodedArrayItem encodedArrayItem = null; if(!dexFile.getInplace() && staticFieldInitializers != null && staticFieldInitializers.size() > 0) { assert classData != null; assert staticFieldInitializers.size() == classData.getStaticFieldCount();
/** * Place the item at the given offset and index, and return the offset of the byte following this item * @param offset The offset to place the item at * @param index The index of the item within the containing section * @return The offset of the byte following this item */ protected int placeAt(int offset, int index) { try { assert AlignmentUtils.isAligned(offset, getItemType().ItemAlignment); assert !dexFile.getInplace() || (offset == this.offset && this.index == index); this.offset = offset; this.index = index; return this.placeItem(offset); } catch (Exception ex) { throw addExceptionContext(ex); } }