public byte[] convert(String javaFile) throws JadxException { try (ByteArrayOutputStream out = new ByteArrayOutputStream(); ByteArrayOutputStream errOut = new ByteArrayOutputStream()) { DxContext context = new DxContext(out, errOut); DxArgs args = new DxArgs(context, "-", new String[]{javaFile}); int result = (new Main(context)).runDx(args); dxErrors = errOut.toString(CHARSET_NAME); if (result != 0) { throw new JadxException("Java to dex conversion error, code: " + result); } return out.toByteArray(); } catch (Exception e) { throw new JadxException("dx exception: " + e.getMessage(), e); } }
com.android.dx.dex.file.DexFile dxFile = new com.android.dx.dex.file.DexFile(dexOptions); try { CfTranslator.translate(new DxContext(), dcf, data, cfOptions, dexOptions, dxFile); } catch (ParseException e) { if ("MethodHandle not supported".equals(e.getMessage())) {
/** * Parses only command-line flags and updates the state of the {@code Arguments} object * accordingly. * * @param flags {@code non-null;} the flags */ public void parseFlags(String[] flags) { parseFlags(new ArgumentsParser(flags)); }
/** * Run and exit if something unexpected happened. * @param argArray the command line arguments */ public static void main(String[] argArray) throws IOException { DxContext context = new DxContext(); Arguments arguments = new Arguments(); arguments.parseCommandLine(argArray, context); int result = new Main(context).run(arguments); if (result != 0) { System.exit(result); } }
/** * Run and exit if something unexpected happened. * @param argArray the command line arguments */ public static void main(String[] argArray) throws IOException { DxContext context = new DxContext(); Arguments arguments = new Arguments(context); arguments.parse(argArray); int result = new Main(context).runDx(arguments); if (result != 0) { throw new IOException(); } }
/** * Run and exit if something unexpected happened. * @param argArray the command line arguments */ public static void main(String[] argArray) throws IOException { Arguments arguments = new Arguments(); arguments.parse(argArray); int result = run(arguments); if (result != 0) { System.exit(result); } }
private void rotateDexFile() { if (outputDex != null) { if (dexOutPool != null) { dexOutputFutures.add(dexOutPool.submit(new DexWriter(outputDex))); } else { dexOutputArrays.add(writeDex(outputDex)); } } createDexFile(); }
/** * Processes one pathname element. * * @param pathname {@code non-null;} the pathname to process. May * be the path of a class file, a jar file, or a directory * containing class files. * @param filter {@code non-null;} A filter for excluding files. */ private void processOne(String pathname, FileNameFilter filter) { ClassPathOpener opener; opener = new ClassPathOpener(pathname, true, filter, new FileBytesConsumer()); if (opener.process()) { updateStatus(true); } }
private Boolean call(DirectClassFile cf) { // Submit class to translation phase. Future<ClassDefItem> cdif = classTranslatorPool.submit( new ClassTranslatorTask(bytes, cf)); Future<Boolean> res = classDefItemConsumer.submit(new ClassDefItemConsumer( name, cdif)); addToDexFutures.add(res); return true; } }
/** * Run and exit if something unexpected happened. * @param argArray the command line arguments */ public static void main(String[] argArray) throws IOException { DxContext context = new DxContext(); Arguments arguments = new Arguments(context); arguments.parse(argArray); int result = new Main(context).runDx(arguments); if (result != 0) { System.exit(result); } }
/** * Parses only command-line flags and updates the state of the {@code Arguments} object * accordingly. * * @param flags {@code non-null;} the flags */ public void parseFlags(String[] flags) { parseFlags(new ArgumentsParser(flags)); }
public Arguments() { this(new DxContext()); }
/** * Processes one pathname element. * * @param pathname {@code non-null;} the pathname to process. May * be the path of a class file, a jar file, or a directory * containing class files. * @param filter {@code non-null;} A filter for excluding files. */ private void processOne(String pathname, FileNameFilter filter) { ClassPathOpener opener; opener = new ClassPathOpener(pathname, true, filter, new FileBytesConsumer()); if (opener.process()) { updateStatus(true); } }
/** * Run and exit if something unexpected happened. * @param argArray the command line arguments */ public static void main(String[] argArray) throws IOException { Arguments arguments = new Arguments(); arguments.parse(argArray); int result = run(arguments); if (result != 0) { System.exit(result); } }
public void parseFlags(String[] flags) { parseFlags(new ArgumentsParser(flags)); }
public Arguments() { this(new DxContext()); }
/** * Processes one pathname element. * * @param pathname {@code non-null;} the pathname to process. May * be the path of a class file, a jar file, or a directory * containing class files. * @param filter {@code non-null;} A filter for excluding files. */ private void processOne(String pathname, FileNameFilter filter) { ClassPathOpener opener; opener = new ClassPathOpener(pathname, true, filter, new FileBytesConsumer()); if (opener.process()) { updateStatus(true); } }