public int getOdexVersion() { return OdexHeaderItem.getVersion(odexBuf, 0); }
public static boolean verifyMagic(byte[] buf) { // verifies the magic value return getVersion(buf) != 0; }
public int getOdexVersion() { return OdexHeaderItem.getVersion(odexBuf); }
public int getOdexVersion() { return OdexHeaderItem.getVersion(odexBuf, 0); }
/** * Verifies that the odex header is valid and a supported version * * @param buf A byte array containing at least the first 8 bytes of an odex file * @param offset The offset within the array to the odex header * @throws NotAnOdexFile If the file is not an odex file * @throws UnsupportedFile If the odex header is valid, but uses unsupported functionality */ public static void verifyOdexHeader(@Nonnull byte[] buf, int offset) { int odexVersion = OdexHeaderItem.getVersion(buf, offset); if (odexVersion == -1) { StringBuilder sb = new StringBuilder("Not a valid odex magic value:"); for (int i=0; i<8; i++) { sb.append(String.format(" %02x", buf[i])); } throw new NotAnOdexFile(sb.toString()); } if (!OdexHeaderItem.isSupportedOdexVersion(odexVersion)) { throw new UnsupportedFile(String.format("Odex version %03d is not supported", odexVersion)); } }
/** * Verifies that the odex header is valid and a supported version * * @param buf A byte array containing at least the first 8 bytes of an odex file * @param offset The offset within the array to the odex header * @throws NotAnOdexFile If the file is not an odex file * @throws UnsupportedFile If the odex header is valid, but uses unsupported functionality */ public static void verifyOdexHeader(@Nonnull byte[] buf, int offset) { int odexVersion = OdexHeaderItem.getVersion(buf, offset); if (odexVersion == -1) { StringBuilder sb = new StringBuilder("Not a valid odex magic value:"); for (int i=0; i<8; i++) { sb.append(String.format(" %02x", buf[i])); } throw new NotAnOdexFile(sb.toString()); } if (!OdexHeaderItem.isSupportedOdexVersion(odexVersion)) { throw new UnsupportedFile(String.format("Odex version %03d is not supported", odexVersion)); } }