Package org.jf.dexlib2.util
Class DexUtil
- java.lang.Object
-
- org.jf.dexlib2.util.DexUtil
-
public class DexUtil extends java.lang.Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
DexUtil.InvalidFile
static class
DexUtil.UnsupportedFile
-
Constructor Summary
Constructors Constructor Description DexUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static int
verifyCdexHeader(byte[] buf, int offset)
Verifies that the cdex header is valid and a supported versionstatic int
verifyDexHeader(byte[] buf, int offset)
Verifies that the dex header is valid and a supported versionstatic int
verifyDexHeader(java.io.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 void
verifyOdexHeader(byte[] buf, int offset)
Verifies that the odex header is valid and a supported versionstatic void
verifyOdexHeader(java.io.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
-
-
-
Method Detail
-
verifyDexHeader
public static int verifyDexHeader(@Nonnull java.io.InputStream inputStream) throws java.io.IOException
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 functionalityjava.io.IOException
-
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
public static void verifyOdexHeader(@Nonnull java.io.InputStream inputStream) throws java.io.IOException
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 versionjava.io.IOException
-
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
-
-