public final class DexFileFactory
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
protected static class |
DexFileFactory.DexEntryFinder |
static class |
DexFileFactory.DexFileNotFoundException |
static class |
DexFileFactory.FilenameVdexProvider |
static class |
DexFileFactory.MultipleMatchingDexEntriesException |
static class |
DexFileFactory.UnsupportedFileTypeException |
static class |
DexFileFactory.UnsupportedOatVersionException |
| Modifier and Type | Method and Description |
|---|---|
static MultiDexContainer<? extends DexBackedDexFile> |
loadDexContainer(java.io.File file,
Opcodes opcodes)
Loads a file containing 1 or more dex files
If the given file is a dex or odex file, it will return a MultiDexContainer containing that single entry.
|
static MultiDexContainer.DexEntry<? extends DexBackedDexFile> |
loadDexEntry(java.io.File file,
java.lang.String dexEntry,
boolean exactMatch,
Opcodes opcodes)
Loads a dex entry from a container format (zip/oat)
This has two modes of operation, depending on the exactMatch parameter.
|
static DexBackedDexFile |
loadDexFile(java.io.File file,
Opcodes opcodes)
Loads a dex/apk/odex/oat file.
|
static DexBackedDexFile |
loadDexFile(java.lang.String path,
Opcodes opcodes) |
static void |
writeDexFile(java.lang.String path,
DexFile dexFile)
Writes a DexFile out to disk
|
@Nonnull public static DexBackedDexFile loadDexFile(@Nonnull java.lang.String path, @Nullable Opcodes opcodes) throws java.io.IOException
java.io.IOException@Nonnull public static DexBackedDexFile loadDexFile(@Nonnull java.io.File file, @Nullable Opcodes opcodes) throws java.io.IOException
file - The file to openopcodes - The set of opcodes to useDexFileFactory.UnsupportedOatVersionException - If file refers to an unsupported oat fileDexFileFactory.DexFileNotFoundException - If file does not exist, if file is a zip file but does not have a "classes.dex"
entry, or if file is an oat file that has no dex entries.DexFileFactory.UnsupportedFileTypeException - If file is not a valid dex/zip/odex/oat file, or if the "classes.dex" entry
in a zip file is not a valid dex filejava.io.IOExceptionpublic static MultiDexContainer.DexEntry<? extends DexBackedDexFile> loadDexEntry(@Nonnull java.io.File file, @Nonnull java.lang.String dexEntry, boolean exactMatch, @Nullable Opcodes opcodes) throws java.io.IOException
file - The container file. This must be either a zip (apk) file or an oat file.dexEntry - The name of the entry to load. This can either be the exact entry name, if exactMatch is true,
or it can be a path suffix.exactMatch - If true, dexEopcodes - The set of opcodes to useDexFileFactory.UnsupportedOatVersionException - If file refers to an unsupported oat fileDexFileFactory.DexFileNotFoundException - If the file does not exist, or if no matching entry could be foundDexFileFactory.UnsupportedFileTypeException - If file is not a valid zip/oat file, or if the matching entry is not a
valid dex fileDexFileFactory.MultipleMatchingDexEntriesException - If multiple entries match the given dexEntryjava.io.IOExceptionpublic static MultiDexContainer<? extends DexBackedDexFile> loadDexContainer(@Nonnull java.io.File file, @Nullable Opcodes opcodes) throws java.io.IOException
file - The file to openopcodes - The set of opcodes to useDexFileFactory.DexFileNotFoundException - If the given file does not existDexFileFactory.UnsupportedFileTypeException - If the given file is not a valid dex/zip/odex/oat filejava.io.IOExceptionpublic static void writeDexFile(@Nonnull
java.lang.String path,
@Nonnull
DexFile dexFile)
throws java.io.IOException
path - The path to write the dex file todexFile - a DexFile to writejava.io.IOException