本文整理汇总了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);
}
}
示例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));
}
}
示例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);
}
}