public void internClass(final ClassDef clz) { curPool.mark(); curPool.internClass(clz); if (hasOverflowed()) { // reset to state before overflow occurred curPool.reset(); // we need a new dexpool newDexPool(); // re-execute on new pool since the last execution was dropped // NOTE: We do not want to call internClass recursively here, this // might end in an endless loop // if the class is to large for a single dex file! curPool.internClass(clz); // If a single class causes an overflow, we're really out of luck if (curPool.hasOverflowed()) { throw new RuntimeException("Class is bigger than a single dex file can be"); } } }
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); }
dexPool.internClass(class1); dexPool.mark(); dexPool.internClass(class2); dexPool.reset(); dexPool.writeTo(dataStore); dexPool.internClass(class1); dexPool.writeTo(dataStore); dexFile2 = new RawDexFile(Opcodes.getDefault(), dataStore.getBuffer());