当前位置: 首页>>代码示例>>Java>>正文


Java HeaderItem.LITTLE_ENDIAN_TAG属性代码示例

本文整理汇总了Java中org.jf.dexlib2.dexbacked.raw.HeaderItem.LITTLE_ENDIAN_TAG属性的典型用法代码示例。如果您正苦于以下问题:Java HeaderItem.LITTLE_ENDIAN_TAG属性的具体用法?Java HeaderItem.LITTLE_ENDIAN_TAG怎么用?Java HeaderItem.LITTLE_ENDIAN_TAG使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.jf.dexlib2.dexbacked.raw.HeaderItem的用法示例。


在下文中一共展示了HeaderItem.LITTLE_ENDIAN_TAG属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: verifyMagicAndByteOrder

private static void verifyMagicAndByteOrder(@Nonnull byte[] buf, int offset) {
    if (!HeaderItem.verifyMagic(buf, offset)) {
        StringBuilder sb = new StringBuilder("Invalid magic value:");
        for (int i=0; i<8; i++) {
            sb.append(String.format(" %02x", buf[i]));
        }
        throw new NotADexFile(sb.toString());
    }

    int endian = HeaderItem.getEndian(buf, offset);
    if (endian == HeaderItem.BIG_ENDIAN_TAG) {
        throw new ExceptionWithContext("Big endian dex files are not currently supported");
    }

    if (endian != HeaderItem.LITTLE_ENDIAN_TAG) {
        throw new ExceptionWithContext("Invalid endian tag: 0x%x", endian);
    }
}
 
开发者ID:Miracle963,项目名称:zjdroid,代码行数:18,代码来源:DexBackedDexFile.java

示例2: verifyDexHeader

/**
 * Verifies that the dex header is valid and a supported version
 *
 * @param buf A byte array containing at least the first 44 bytes of a dex file
 * @param offset The offset within the array to the dex header
 * @throws NotADexFile If the file is not a dex file
 * @throws InvalidFile If the header appears to be a dex file, but is not valid for some reason
 * @throws UnsupportedFile If the dex header is valid, but uses unsupported functionality
 */
public static void verifyDexHeader( byte[] buf, int offset) {
    int dexVersion = HeaderItem.getVersion(buf, offset);
    if (dexVersion == -1) {
        StringBuilder sb = new StringBuilder("Not a valid dex magic value:");
        for (int i=0; i<8; i++) {
            sb.append(String.format(" %02x", buf[i]));
        }
        throw new NotADexFile(sb.toString());
    }

    if (!HeaderItem.isSupportedDexVersion(dexVersion)) {
        throw new UnsupportedFile(String.format("Dex version %03d is not supported", dexVersion));
    }

    int endian = HeaderItem.getEndian(buf, offset);
    if (endian == HeaderItem.BIG_ENDIAN_TAG) {
        throw new UnsupportedFile("Big endian dex files are not supported");
    }

    if (endian != HeaderItem.LITTLE_ENDIAN_TAG) {
        throw new InvalidFile(String.format("Invalid endian tag: 0x%x", endian));
    }
}
 
开发者ID:AndreJCL,项目名称:JCL,代码行数:32,代码来源:DexUtil.java

示例3: verifyMagicAndByteOrder

private static void verifyMagicAndByteOrder(@Nonnull byte[] buf, int offset) {
    if (!HeaderItem.verifyMagic(buf, offset)) {
        StringBuilder sb = new StringBuilder("Invalid magic value:");
        for (int i = 0; i < 8; i++) {
            sb.append(String.format(" %02x", buf[i]));
        }
        throw new NotADexFile(sb.toString());
    }

    int endian = HeaderItem.getEndian(buf, offset);
    if (endian == HeaderItem.BIG_ENDIAN_TAG) {
        throw new ExceptionWithContext("Big endian dex files are not currently supported");
    }

    if (endian != HeaderItem.LITTLE_ENDIAN_TAG) {
        throw new ExceptionWithContext("Invalid endian tag: 0x%x", endian);
    }
}
 
开发者ID:niranjan94,项目名称:show-java,代码行数:18,代码来源:DexBackedDexFile.java


注:本文中的org.jf.dexlib2.dexbacked.raw.HeaderItem.LITTLE_ENDIAN_TAG属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。