Tabnine Logo
DexFileFactory.writeDexFile
Code IndexAdd Tabnine to your IDE (free)

How to use
writeDexFile
method
in
org.jf.dexlib2.DexFileFactory

Best Java code snippets using org.jf.dexlib2.DexFileFactory.writeDexFile (Showing top 7 results out of 315)

origin: com.taobao.android/dex_patch

public void writeDex(File outDexFile,Set<ClassDef>classDefs) throws IOException {
  DexFileFactory.writeDexFile(outDexFile.getAbsolutePath(), new DexFile() {
    @Nonnull
    @Override
    public Set<? extends ClassDef> getClasses() {
      return new AbstractSet<ClassDef>() {
        @Nonnull
        @Override
        public Iterator<ClassDef> iterator() {
          return classDefs.iterator();
        }
        @Override
        public int size() {
          return classDefs.size();
        }
      };
    }
  });
}
origin: com.taobao.android/dex_patch

public static Set<String> buildCode(File dexFile, DexDiffInfo info) throws IOException,
    RecognitionException {
  Set<String>classes = new HashSet<>();
  Set<DexBackedClassDef> classDefs = new HashSet<DexBackedClassDef>();
  classDefs.addAll(info.getModifiedClasses());
  classDefs.addAll(info.getAddedClasses());
  DexFileFactory.writeDexFile(dexFile.getAbsolutePath(), new DexFile() {
    @Nonnull
    @Override
    public Set<? extends ClassDef> getClasses() {
      return new AbstractSet<DexBackedClassDef>() {
        @Override
        public Iterator<DexBackedClassDef> iterator() {
          return classDefs.iterator();
        }
        @Override
        public int size() {
          return classDefs.size();
        }
      };
    }
  });
  for (ClassDef classDef:classDefs){
    classes.add(classDef.getType());
  }
  return classes;
}
origin: com.taobao.android/dex_patch

  obfuscateClasses.add(insTructionsReDef.reClassDef(classDef));
DexFileFactory.writeDexFile(outPutFile.getAbsolutePath(), new DexFile() {
  @Nonnull
  @Override
origin: com.taobao.android/dex_patch

  DexFileFactory.writeDexFile(patchDexFile.getAbsolutePath(), new ImmutableDexFile(newClassDef.keySet()));
} else if (patchClassDefs.size() > 0) {
  DexFileFactory.writeDexFile(patchDexFile.getAbsolutePath(), new ImmutableDexFile(patchClassDefs.keySet()));
  DexFileFactory.writeDexFile(tempDexFile.getAbsolutePath(), new DexFile() {
    @Nonnull
    @Override
  DexFileFactory.writeDexFile(tempDexFile.getAbsolutePath(), new ImmutableDexFile(classes));
origin: com.taobao.android/dex_patch

public static void addField(String inFile, String outFile, DexBackedClassDef dexBackedClassDef, ImmutableField immutableField) throws IOException {
  DexFile dexFile = readDexFile(inFile);
  for (ClassDef classDef : dexFile.getClasses()) {
    if (dexBackedClassDef != null && dexBackedClassDef.getType().equals(classDef.getType())) {
      dexFile = addField(dexFile, classDef.getType(), immutableField);
    } else if (dexBackedClassDef == null) {
      dexFile = addField(dexFile, classDef.getType(), immutableField);
    }
  }
  reDexFile(dexFile);
  DexFileFactory.writeDexFile(outFile, new DexFile() {
    @Nonnull
    @Override
    public Set<? extends ClassDef> getClasses() {
      return new AbstractSet<ClassDef>() {
        @Nonnull
        @Override
        public Iterator<ClassDef> iterator() {
          return classes.iterator();
        }
        @Override
        public int size() {
          return classes.size();
        }
      };
    }
  });
}
origin: com.taobao.android/dex_patch

DexFileFactory.writeDexFile(outDexFile, new DexFile() {
  @Nonnull
  @Override
origin: testwhat/SmaliEx

@Test
public void testPoolCallSite() throws IOException {
  ClassDef class1 = new ImmutableClassDef("Lcls1;", AccessFlags.PUBLIC.getValue(), "Ljava/lang/Object;", null, null,
      null, null,
      Lists.<Method>newArrayList(
          new ImmutableMethod("Lcls1", "method1",
              ImmutableList.of(), "V", AccessFlags.PUBLIC.getValue(), null,
              new ImmutableMethodImplementation(10, ImmutableList.of(
                  new ImmutableInstruction35c(Opcode.INVOKE_CUSTOM, 0, 0, 0, 0, 0, 0,
                      new ImmutableCallSiteReference("call_site_1",
                          new ImmutableMethodHandleReference(MethodHandleType.INVOKE_STATIC,
                              new ImmutableMethodReference("Lcls1", "loader",
                                  ImmutableList.of("Ljava/lang/invoke/Lookup;",
                                      "Ljava/lang/String;",
                                      "Ljava/lang/invoke/MethodType;"),
                                  "Ljava/lang/invoke/CallSite;")),
                          "someMethod", new ImmutableMethodProtoReference(ImmutableList.of(), "V"), ImmutableList.of()))
              ), null, null))));
  File tempFile = File.createTempFile("dex", ".dex");
  DexFileFactory.writeDexFile(tempFile.getPath(),
      new ImmutableDexFile(Opcodes.forArtVersion(111), ImmutableList.of(class1)));
  verifyDexFile(DexFileFactory.loadDexFile(tempFile, Opcodes.forArtVersion(111)));
}
org.jf.dexlib2DexFileFactorywriteDexFile

Javadoc

Writes a DexFile out to disk

Popular methods of DexFileFactory

  • loadDexFile
  • loadDexContainer
    Loads a file containing 1 or more dex files If the given file is a dex or odex file, it will return
  • loadDexEntry
    Loads a dex entry from a container format (zip/oat) This has two modes of operation, depending on th
  • loadDexFiles

Popular in Java

  • Reactive rest calls using spring rest template
  • scheduleAtFixedRate (Timer)
  • getContentResolver (Context)
  • addToBackStack (FragmentTransaction)
  • MessageFormat (java.text)
    Produces concatenated messages in language-neutral way. New code should probably use java.util.Forma
  • NumberFormat (java.text)
    The abstract base class for all number formats. This class provides the interface for formatting and
  • GregorianCalendar (java.util)
    GregorianCalendar is a concrete subclass of Calendarand provides the standard calendar used by most
  • ThreadPoolExecutor (java.util.concurrent)
    An ExecutorService that executes each submitted task using one of possibly several pooled threads, n
  • AtomicInteger (java.util.concurrent.atomic)
    An int value that may be updated atomically. See the java.util.concurrent.atomic package specificati
  • JarFile (java.util.jar)
    JarFile is used to read jar entries and their associated data from jar files.
  • Github Copilot alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now