Dex文件的合成與分解
一、DexPatchFile類
Dex文件分為這幾個區域:
StringData| Integer| ProtoId| FieldId|MethodId|ClassDef|TypeList|AnnotationSetRefList|AnnotationSet|ClassData|Code|DebugInfoItem|Annotation|EncodedValue|AnnotationsDirectory
-----|-----|------|-----|----|-----|-----|-----|-----|-------|-----|-----|-----|------
StringData| Integer| ProtoId| FieldId|MethodId|ClassDef|TypeList|AnnotationSetRefList|AnnotationSet|ClassData|Code|DebugInfoItem|Annotation|EncodedValue|AnnotationsDirectory
public DexPatchApplier(
InputStream oldDexIn,
int initDexSize,
InputStream patchFileIn,
SmallPatchedDexItemFile extraInfoFile) throws IOException {
this(
new Dex(oldDexIn, initDexSize),
(patchFileIn != null ? new DexPatchFile(patchFileIn) : null),
extraInfoFile
);}
構造成生一個老的Dex
文件,一個DexPatchFile
文件,一個SmallPatchedDexItemFile
文件。
executeAndSaveTo(OutputStream out)
分塊合成算法,合成后,存儲在outputStream里面。