Package org.jf.dexlib2.rewriter
Class DexRewriter
- java.lang.Object
-
- org.jf.dexlib2.rewriter.DexRewriter
-
- All Implemented Interfaces:
Rewriters
public class DexRewriter extends java.lang.Object implements Rewriters
Out-of-the box, this class does nothing except make a picture-perfect copy of a dex file. However, it provides many points where you can hook into this process and selectively modify the dex file. For example, If you want to rename all instances (including definitions and references) of the class Lorg/blah/MyBlah; to Lorg/blah/YourBlah;DexRewriter rewriter = new DexRewriter(new RewriterModule() { public Rewriter<String> getTypeRewriter(Rewriters rewriters) { return new Rewriter<String>() { public String rewrite(String value) { if (value.equals("Lorg/blah/MyBlah;")) { return "Lorg/blah/YourBlah;"; } return value; } }; } }); DexFile rewrittenDexFile = rewriter.rewriteDexFile(dexFile);
-
-
Constructor Summary
Constructors Constructor Description DexRewriter(RewriterModule module)
-
Method Summary
-
-
-
Constructor Detail
-
DexRewriter
public DexRewriter(RewriterModule module)
-
-
Method Detail
-
getDexFileRewriter
@Nonnull public Rewriter<DexFile> getDexFileRewriter()
- Specified by:
getDexFileRewriterin interfaceRewriters
-
getClassDefRewriter
@Nonnull public Rewriter<ClassDef> getClassDefRewriter()
- Specified by:
getClassDefRewriterin interfaceRewriters
-
getFieldRewriter
@Nonnull public Rewriter<Field> getFieldRewriter()
- Specified by:
getFieldRewriterin interfaceRewriters
-
getMethodRewriter
@Nonnull public Rewriter<Method> getMethodRewriter()
- Specified by:
getMethodRewriterin interfaceRewriters
-
getMethodParameterRewriter
@Nonnull public Rewriter<MethodParameter> getMethodParameterRewriter()
- Specified by:
getMethodParameterRewriterin interfaceRewriters
-
getMethodImplementationRewriter
@Nonnull public Rewriter<MethodImplementation> getMethodImplementationRewriter()
- Specified by:
getMethodImplementationRewriterin interfaceRewriters
-
getInstructionRewriter
@Nonnull public Rewriter<Instruction> getInstructionRewriter()
- Specified by:
getInstructionRewriterin interfaceRewriters
-
getTryBlockRewriter
@Nonnull public Rewriter<TryBlock<? extends ExceptionHandler>> getTryBlockRewriter()
- Specified by:
getTryBlockRewriterin interfaceRewriters
-
getExceptionHandlerRewriter
@Nonnull public Rewriter<ExceptionHandler> getExceptionHandlerRewriter()
- Specified by:
getExceptionHandlerRewriterin interfaceRewriters
-
getDebugItemRewriter
@Nonnull public Rewriter<DebugItem> getDebugItemRewriter()
- Specified by:
getDebugItemRewriterin interfaceRewriters
-
getTypeRewriter
@Nonnull public Rewriter<java.lang.String> getTypeRewriter()
- Specified by:
getTypeRewriterin interfaceRewriters
-
getFieldReferenceRewriter
@Nonnull public Rewriter<FieldReference> getFieldReferenceRewriter()
- Specified by:
getFieldReferenceRewriterin interfaceRewriters
-
getMethodReferenceRewriter
@Nonnull public Rewriter<MethodReference> getMethodReferenceRewriter()
- Specified by:
getMethodReferenceRewriterin interfaceRewriters
-
getAnnotationRewriter
@Nonnull public Rewriter<Annotation> getAnnotationRewriter()
- Specified by:
getAnnotationRewriterin interfaceRewriters
-
getAnnotationElementRewriter
@Nonnull public Rewriter<AnnotationElement> getAnnotationElementRewriter()
- Specified by:
getAnnotationElementRewriterin interfaceRewriters
-
getEncodedValueRewriter
@Nonnull public Rewriter<EncodedValue> getEncodedValueRewriter()
- Specified by:
getEncodedValueRewriterin interfaceRewriters
-
-