Class HeaderItem


  • public class HeaderItem
    extends java.lang.Object
    • Method Detail

      • getChecksum

        public int getChecksum()
      • getSignature

        @Nonnull
        public byte[] getSignature()
      • getMapOffset

        public int getMapOffset()
      • getHeaderSize

        public int getHeaderSize()
      • getStringCount

        public int getStringCount()
      • getStringOffset

        public int getStringOffset()
      • getTypeCount

        public int getTypeCount()
      • getTypeOffset

        public int getTypeOffset()
      • getProtoCount

        public int getProtoCount()
      • getProtoOffset

        public int getProtoOffset()
      • getFieldCount

        public int getFieldCount()
      • getFieldOffset

        public int getFieldOffset()
      • getMethodCount

        public int getMethodCount()
      • getMethodOffset

        public int getMethodOffset()
      • getClassCount

        public int getClassCount()
      • getClassOffset

        public int getClassOffset()
      • getMagicForApi

        public static byte[] getMagicForApi​(int api)
        Get the highest magic number supported by Android for this api level.
        Returns:
        The dex file magic number
      • getMagicForDexVersion

        public static byte[] getMagicForDexVersion​(int dexVersion)
      • verifyMagic

        public static boolean verifyMagic​(byte[] buf,
                                          int offset)
        Verifies the magic value at the beginning of a dex file
        Parameters:
        buf - A byte array containing at least the first 8 bytes of a dex file
        offset - The offset within the buffer to the beginning of the dex header
        Returns:
        True if the magic value is valid
      • getVersion

        public static int getVersion​(byte[] buf,
                                     int offset)
        Gets the dex version from a dex header
        Parameters:
        buf - A byte array containing at least the first 7 bytes of a dex file
        offset - The offset within the buffer to the beginning of the dex header
        Returns:
        The dex version if the header is valid or -1 if the header is invalid
      • isSupportedDexVersion

        public static boolean isSupportedDexVersion​(int version)
      • getEndian

        public static int getEndian​(byte[] buf,
                                    int offset)