mirror of
https://github.com/revanced/multidexlib2.git
synced 2025-04-29 22:24:28 +02:00
Add RawDexIO.writeRawDexFile(DexDataStore dataStore, ...)
This commit is contained in:
parent
44fc0cf19e
commit
429f4ac79b
@ -29,6 +29,7 @@ import com.google.common.collect.PeekingIterator;
|
||||
import org.jf.dexlib2.Opcodes;
|
||||
import org.jf.dexlib2.iface.ClassDef;
|
||||
import org.jf.dexlib2.iface.DexFile;
|
||||
import org.jf.dexlib2.writer.io.DexDataStore;
|
||||
import org.jf.dexlib2.writer.io.FileDataStore;
|
||||
import org.jf.dexlib2.writer.pool.DexPool;
|
||||
|
||||
@ -44,8 +45,8 @@ public class DexIO {
|
||||
|
||||
// Single-Threaded Write
|
||||
|
||||
static void writeRawDexSingleThread(File file, DexFile dexFile, int maxDexPoolSize, DexIO.Logger logger)
|
||||
throws IOException {
|
||||
static void writeRawDexSingleThread(DexDataStore dataStore, DexFile dexFile, int maxDexPoolSize,
|
||||
DexIO.Logger logger, File file) throws IOException {
|
||||
Set<? extends ClassDef> classes = dexFile.getClasses();
|
||||
Iterator<? extends ClassDef> classIterator = classes.iterator();
|
||||
DexPool dexPool = new DexPool(dexFile.getOpcodes());
|
||||
@ -60,7 +61,7 @@ public class DexIO {
|
||||
classCount++;
|
||||
}
|
||||
if (logger != null) logger.log(file, SingletonDexContainer.UNDEFINED_ENTRY_NAME, classCount);
|
||||
dexPool.writeTo(new FileDataStore(file));
|
||||
dexPool.writeTo(dataStore);
|
||||
}
|
||||
|
||||
static void writeMultiDexDirectorySingleThread(boolean multiDex, File directory, DexFileNameIterator nameIterator,
|
||||
|
@ -21,6 +21,8 @@ import org.jf.dexlib2.dexbacked.DexBackedDexFile;
|
||||
import org.jf.dexlib2.dexbacked.raw.HeaderItem;
|
||||
import org.jf.dexlib2.iface.DexFile;
|
||||
import org.jf.dexlib2.util.DexUtil;
|
||||
import org.jf.dexlib2.writer.io.DexDataStore;
|
||||
import org.jf.dexlib2.writer.io.FileDataStore;
|
||||
|
||||
public class RawDexIO {
|
||||
|
||||
@ -67,11 +69,15 @@ public class RawDexIO {
|
||||
|
||||
public static void writeRawDexFile(File file, DexFile dexFile, int maxDexPoolSize, DexIO.Logger logger)
|
||||
throws IOException {
|
||||
DexIO.writeRawDexSingleThread(file, dexFile, maxDexPoolSize, logger);
|
||||
DexIO.writeRawDexSingleThread(new FileDataStore(file), dexFile, maxDexPoolSize, logger, file);
|
||||
}
|
||||
|
||||
public static void writeRawDexFile(File file, DexFile dexFile, int maxDexPoolSize) throws IOException {
|
||||
DexIO.writeRawDexSingleThread(file, dexFile, maxDexPoolSize, null);
|
||||
DexIO.writeRawDexSingleThread(new FileDataStore(file), dexFile, maxDexPoolSize, null, null);
|
||||
}
|
||||
|
||||
public static void writeRawDexFile(DexDataStore dataStore, DexFile dexFile, int maxDexPoolSize) throws IOException {
|
||||
DexIO.writeRawDexSingleThread(dataStore, dexFile, maxDexPoolSize, null, null);
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user