protected void newDexPool() { curPool = new DexPool(opcodes); dexPools.add(curPool); }
public static void writeTo(@Nonnull String path, @Nonnull org.jf.dexlib2.iface.DexFile input) throws IOException { DexPool dexPool = new DexPool(input.getOpcodes()); for (ClassDef classDef: input.getClasses()) { dexPool.internClass(classDef); } dexPool.writeTo(new FileDataStore(new File(path))); }
public static void writeTo(@Nonnull DexDataStore dataStore, @Nonnull org.jf.dexlib2.iface.DexFile input) throws IOException { DexPool dexPool = new DexPool(input.getOpcodes()); for (ClassDef classDef: input.getClasses()) { dexPool.internClass(classDef); } dexPool.writeTo(dataStore); }
public static void writeTo(@Nonnull String path, @Nonnull org.jf.dexlib2.iface.DexFile input) throws IOException { DexPool dexPool = new DexPool(input.getOpcodes()); for (ClassDef classDef: input.getClasses()) { dexPool.internClass(classDef); } dexPool.writeTo(new FileDataStore(new File(path))); }
public static void writeTo(@Nonnull DexDataStore dataStore, @Nonnull org.jf.dexlib2.iface.DexFile input) throws IOException { DexPool dexPool = new DexPool(input.getOpcodes()); for (ClassDef classDef: input.getClasses()) { dexPool.internClass(classDef); } dexPool.writeTo(dataStore); }
public <C extends ClassDef> void writeClassesTo( List<C> classList, DexDataStoreFactory store) throws IOException { int dexNum = 0; DexPool dexPool = new DexPool(opcodes); ClassPool clsPool = dexPool.classSection; classList.sort(Comparator.comparing(ClassDef::getType)); for (ClassDef classDef : classList) { int numMethodIds = dexPool.methodSection.getItemCount(); int numFieldIds = dexPool.fieldSection.getItemCount(); int constantPoolSize = classDef.getDirectMethodCount() + classDef.getVirtualMethodCount() + classDef.getStaticFieldCount() + classDef.getInstanceFieldCount(); int maxMethodIdsInDex = numMethodIds + constantPoolSize + MAX_METHOD_ADDED_DURING_DEX_CREATION; int maxFieldIdsInDex = numFieldIds + constantPoolSize + MAX_FIELD_ADDED_DURING_DEX_CREATION; if (maxMethodIdsInDex > mMaxNumberOfIdxPerDex || maxFieldIdsInDex > mMaxNumberOfIdxPerDex) { dexPool.writeTo(store.getDataStore(dexNum)); dexNum++; dexPool = new DexPool(opcodes); clsPool = dexPool.classSection; } clsPool.intern(classDef); } dexPool.writeTo(store.getDataStore(dexNum)); }
public static DexPool makeDexPool(int api) { StringPool stringPool = new StringPool(); TypePool typePool = new TypePool(stringPool); FieldPool fieldPool = new FieldPool(stringPool, typePool); TypeListPool typeListPool = new TypeListPool(typePool); ProtoPool protoPool = new ProtoPool(stringPool, typePool, typeListPool); MethodPool methodPool = new MethodPool(stringPool, typePool, protoPool); AnnotationPool annotationPool = new AnnotationPool(stringPool, typePool, fieldPool, methodPool); AnnotationSetPool annotationSetPool = new AnnotationSetPool(annotationPool); ClassPool classPool = new ClassPool(stringPool, typePool, fieldPool, methodPool, annotationSetPool, typeListPool); return new DexPool(api, stringPool, typePool, protoPool, fieldPool, methodPool, classPool, typeListPool, annotationPool, annotationSetPool); }