Package org.jf.dexlib2.util
Class DexUtil
java.lang.Object
org.jf.dexlib2.util.DexUtil
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic class -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic intverifyCdexHeader(byte[] buf, int offset) Verifies that the cdex header is valid and a supported versionstatic intverifyDexHeader(byte[] buf, int offset) Verifies that the dex header is valid and a supported versionstatic intverifyDexHeader(InputStream inputStream) Reads in the dex header from the given input stream and verifies that it is valid and a supported version The inputStream must support mark(), and will be reset to initial position upon exiting the methodstatic voidverifyOdexHeader(byte[] buf, int offset) Verifies that the odex header is valid and a supported versionstatic voidverifyOdexHeader(InputStream inputStream) Reads in the odex header from the given input stream and verifies that it is valid and a supported version The inputStream must support mark(), and will be reset to initial position upon exiting the method
-
Constructor Details
-
DexUtil
public DexUtil()
-
-
Method Details
-
verifyDexHeader
Reads in the dex header from the given input stream and verifies that it is valid and a supported version The inputStream must support mark(), and will be reset to initial position upon exiting the method- Parameters:
inputStream- An input stream that is positioned at a dex header- Returns:
- The dex version
- Throws:
DexBackedDexFile.NotADexFile- If the file is not a dex fileDexUtil.InvalidFile- If the header appears to be a dex file, but is not valid for some reasonDexUtil.UnsupportedFile- If the dex header is valid, but uses unsupported functionalityIOException
-
verifyDexHeader
public static int verifyDexHeader(@Nonnull byte[] buf, int offset) Verifies that the dex header is valid and a supported version- Parameters:
buf- A byte array containing at least the first 44 bytes of a dex fileoffset- The offset within the array to the dex header- Returns:
- The dex version
- Throws:
DexBackedDexFile.NotADexFile- If the file is not a dex fileDexUtil.InvalidFile- If the header appears to be a dex file, but is not valid for some reasonDexUtil.UnsupportedFile- If the dex header is valid, but uses unsupported functionality
-
verifyCdexHeader
public static int verifyCdexHeader(@Nonnull byte[] buf, int offset) Verifies that the cdex header is valid and a supported version- Parameters:
buf- A byte array containing at least the first 44 bytes of a cdex fileoffset- The offset within the array to the dex header- Returns:
- The dex version
- Throws:
DexBackedDexFile.NotADexFile- If the file is not a cdex fileDexUtil.InvalidFile- If the header appears to be a cdex file, but is not valid for some reasonDexUtil.UnsupportedFile- If the cdex header is valid, but uses unsupported functionality
-
verifyOdexHeader
Reads in the odex header from the given input stream and verifies that it is valid and a supported version The inputStream must support mark(), and will be reset to initial position upon exiting the method- Parameters:
inputStream- An input stream that is positioned at an odex header- Throws:
DexBackedOdexFile.NotAnOdexFile- If the file is not an odex fileDexUtil.UnsupportedFile- If the odex header is valid, but is an unsupported versionIOException
-
verifyOdexHeader
public static void verifyOdexHeader(@Nonnull byte[] buf, int offset) Verifies that the odex header is valid and a supported version- Parameters:
buf- A byte array containing at least the first 8 bytes of an odex fileoffset- The offset within the array to the odex header- Throws:
DexBackedOdexFile.NotAnOdexFile- If the file is not an odex fileDexUtil.UnsupportedFile- If the odex header is valid, but uses unsupported functionality
-