/** * Writes an annotated hex dump of the given dex file to output. * * @param dexFile The dex file to dump * @param output An OutputStream to write the annotated hex dump to. The caller is responsible for closing this * when needed. * * @throws IOException */ public static void dump(@Nonnull DexBackedDexFile dexFile, @Nonnull OutputStream output) throws IOException { Writer writer = new BufferedWriter(new OutputStreamWriter(output)); try { int consoleWidth = ConsoleUtil.getConsoleWidth(); if (consoleWidth <= 0) { consoleWidth = 120; } RawDexFile rawDexFile = new RawDexFile(dexFile.getOpcodes(), dexFile); DexAnnotator annotator = new DexAnnotator(rawDexFile, consoleWidth); annotator.writeAnnotations(writer); } finally { writer.close(); } } }
public <F extends DexFile> MultiDex(@Nonnull List<F> dexFiles) { Opcodes firstOpcodes = null; if (!dexFiles.isEmpty()) { DexFile dexFile = dexFiles.get(0); if (dexFile instanceof DexBackedDexFile) { DexBackedDexFile dexBackedDexFile = (DexBackedDexFile) dexFile; firstOpcodes = dexBackedDexFile.getOpcodes(); } } opcodes = firstOpcodes == null ? Opcodes.getDefault() : firstOpcodes; dexFiles.forEach(this::addFile); }
private VdexRewriterModule(Vdex.QuickenDex odex, VdexRewriterModule module) { mOdex = odex; mDex = new DexBackedDexFile(module.mDex.getOpcodes(), odex.getBytes()); mGiIter = module.mGiIter; mQiIter = module.mQiIter; }
/** * Writes an annotated hex dump of the given dex file to output. * * @param dexFile The dex file to dump * @param output An OutputStream to write the annotated hex dump to. The caller is responsible for closing this * when needed. * * @throws IOException */ public static void dump(@Nonnull DexBackedDexFile dexFile, @Nonnull OutputStream output) throws IOException { Writer writer = new BufferedWriter(new OutputStreamWriter(output)); try { int consoleWidth = ConsoleUtil.getConsoleWidth(); if (consoleWidth <= 0) { consoleWidth = 120; } RawDexFile rawDexFile = new RawDexFile(dexFile.getOpcodes(), dexFile); DexAnnotator annotator = new DexAnnotator(rawDexFile, consoleWidth); annotator.writeAnnotations(writer); } finally { writer.close(); } } }
options.syntheticAccessorResolver = new SyntheticAccessorResolver(dexFile.getOpcodes(), dexFile.getClasses());
@Nonnull public static Instruction readFrom(@Nonnull DexReader reader) { int opcodeValue = reader.peekUbyte(); if (opcodeValue == 0) { opcodeValue = reader.peekUshort(); } Opcode opcode = reader.dexBuf.getOpcodes().getOpcodeByValue(opcodeValue); Instruction instruction = buildInstruction(reader.dexBuf, opcode, reader.getOffset()); reader.moveRelative(instruction.getCodeUnits()*2); return instruction; }
options.syntheticAccessorResolver = new SyntheticAccessorResolver(dexFile.getOpcodes(), dexFile.getClasses());
@Nonnull public static Instruction readFrom(@Nonnull DexReader reader) { int opcodeValue = reader.peekUbyte(); if (opcodeValue == 0) { opcodeValue = reader.peekUshort(); } Opcode opcode = reader.dexBuf.getOpcodes().getOpcodeByValue(opcodeValue); Instruction instruction = buildInstruction(reader.dexBuf, opcode, reader.getOffset()); reader.moveRelative(instruction.getCodeUnits()*2); return instruction; }
@Nonnull public static Instruction readFrom(@Nonnull DexReader reader) { int opcodeValue = reader.peekUbyte(); if (opcodeValue == 0) { opcodeValue = reader.peekUshort(); } Opcode opcode = reader.dexBuf.getOpcodes().getOpcodeByValue(opcodeValue); Instruction instruction = buildInstruction(reader.dexBuf, opcode, reader.getOffset()); reader.moveRelative(instruction.getCodeUnits()*2); return instruction; }
final DexBackedDexFile odexFile = DexUtil.loadSingleDex(input, opcodes); if (opcodes == null) { opcodes = odexFile.getOpcodes();