public ClassData readClassData(ClassDef classDef) { int offset = classDef.classDataOffset; if (offset == 0) { throw new IllegalArgumentException("offset == 0"); } return openSection(offset).readClassData(); }
public Code readCode(ClassData.Method method) { int offset = method.codeOffset; if (offset == 0) { throw new IllegalArgumentException("offset == 0"); } return openSection(offset).readCode(); }
@Override public ProtoId get(int index) { checkBounds(index, tableOfContents.protoIds.size); return openSection(tableOfContents.protoIds.off + (SizeOf.PROTO_ID_ITEM * index)) .readProtoId(); } @Override public int size() {
public DebugInfoItemSectionPatchAlgorithm( DexPatchFile patchFile, Dex oldDex, Dex patchedDex, SparseIndexMap oldToPatchedIndexMap ) { super(patchFile, oldDex, oldToPatchedIndexMap); if (patchedDex != null) { this.patchedDebugInfoItemTocSec = patchedDex.getTableOfContents().debugInfos; this.patchedDebugInfoItemSec = patchedDex.openSection(this.patchedDebugInfoItemTocSec); } }
public AnnotationsDirectorySectionPatchAlgorithm( DexPatchFile patchFile, Dex oldDex, Dex patchedDex, SparseIndexMap oldToPatchedIndexMap ) { super(patchFile, oldDex, oldToPatchedIndexMap); if (patchedDex != null) { this.patchedAnnotationsDirectoryTocSec = patchedDex.getTableOfContents().annotationsDirectories; this.patchedAnnotationsDirectorySec = patchedDex.openSection(this.patchedAnnotationsDirectoryTocSec); } }
public ProtoIdSectionPatchAlgorithm( DexPatchFile patchFile, Dex oldDex, Dex patchedDex, SparseIndexMap oldToPatchedIndexMap ) { super(patchFile, oldDex, oldToPatchedIndexMap); if (patchedDex != null) { this.patchedProtoIdTocSec = patchedDex.getTableOfContents().protoIds; this.patchedProtoIdSec = patchedDex.openSection(this.patchedProtoIdTocSec); } }
public ClassDefSectionPatchAlgorithm( DexPatchFile patchFile, Dex oldDex, Dex patchedDex, SparseIndexMap oldToPatchedIndexMap ) { super(patchFile, oldDex, oldToPatchedIndexMap); if (patchedDex != null) { this.patchedClassDefTocSec = patchedDex.getTableOfContents().classDefs; this.patchedClassDefSec = patchedDex.openSection(this.patchedClassDefTocSec); } }
@Override public String get(int index) { checkBounds(index, tableOfContents.stringIds.size); int stringOff = openSection(tableOfContents.stringIds.off + (index * SizeOf.STRING_ID_ITEM)).readInt(); return openSection(stringOff).readStringData().value; } @Override public int size() {
@Override public FieldId get(int index) { checkBounds(index, tableOfContents.fieldIds.size); return openSection(tableOfContents.fieldIds.off + (SizeOf.MEMBER_ID_ITEM * index)) .readFieldId(); } @Override public int size() {
public MethodIdSectionPatchAlgorithm( DexPatchFile patchFile, Dex oldDex, Dex patchedDex, SparseIndexMap oldToPatchedIndexMap ) { super(patchFile, oldDex, oldToPatchedIndexMap); if (patchedDex != null) { this.patchedMethodIdTocSec = patchedDex.getTableOfContents().methodIds; this.patchedMethodIdSec = patchedDex.openSection(this.patchedMethodIdTocSec); } }
public CodeSectionPatchAlgorithm( DexPatchFile patchFile, Dex oldDex, Dex patchedDex, SparseIndexMap oldToPatchedIndexMap ) { super(patchFile, oldDex, oldToPatchedIndexMap); if (patchedDex != null) { this.patchedCodeTocSec = patchedDex.getTableOfContents().codes; this.patchedCodeSec = patchedDex.openSection(this.patchedCodeTocSec); } }
@Override public MethodId get(int index) { checkBounds(index, tableOfContents.methodIds.size); return openSection(tableOfContents.methodIds.off + (SizeOf.MEMBER_ID_ITEM * index)) .readMethodId(); } @Override public int size() {
@Override public ClassDef get(int index) { checkBounds(index, tableOfContents.classDefs.size); return openSection(tableOfContents.classDefs.off + (SizeOf.CLASS_DEF_ITEM * index)) .readClassDef(); }
public AnnotationSetSectionPatchAlgorithm( DexPatchFile patchFile, Dex oldDex, Dex patchedDex, SparseIndexMap oldToPatchedIndexMap ) { super(patchFile, oldDex, oldToPatchedIndexMap); if (patchedDex != null) { this.patchedAnnotationSetTocSec = patchedDex.getTableOfContents().annotationSets; this.patchedAnnotationSetSec = patchedDex.openSection(this.patchedAnnotationSetTocSec); } }
public ClassDataSectionPatchAlgorithm( DexPatchFile patchFile, Dex oldDex, Dex patchedDex, SparseIndexMap oldToPatchedIndexMap ) { super(patchFile, oldDex, oldToPatchedIndexMap); if (patchedDex != null) { this.patchedClassDataTocSec = patchedDex.getTableOfContents().classDatas; this.patchedClassDataSec = patchedDex.openSection(this.patchedClassDataTocSec); } }
public AnnotationSectionPatchAlgorithm( DexPatchFile patchFile, Dex oldDex, Dex patchedDex, SparseIndexMap oldToPatchedIndexMap ) { super(patchFile, oldDex, oldToPatchedIndexMap); if (patchedDex != null) { this.patchedAnnotationTocSec = patchedDex.getTableOfContents().annotations; this.patchedAnnotationSec = patchedDex.openSection(this.patchedAnnotationTocSec); } }
public FieldIdSectionPatchAlgorithm( DexPatchFile patchFile, Dex oldDex, Dex patchedDex, SparseIndexMap oldToPatchedIndexMap ) { super(patchFile, oldDex, oldToPatchedIndexMap); if (patchedDex != null) { this.patchedFieldIdTocSec = patchedDex.getTableOfContents().fieldIds; this.patchedFieldIdSec = patchedDex.openSection(this.patchedFieldIdTocSec); } }
public void readFrom(Dex dex) throws IOException { readHeader(dex.openSection(header)); // special case, since mapList.byteCount is available only after // computeSizesFromOffsets() was invoked, so here we can't use // dex.openSection(mapList) to get dex section. Or // an {@code java.nio.BufferUnderflowException} will be thrown. readMap(dex.openSection(mapList.off)); computeSizesFromOffsets(); }
/** * Generates the signature and checksum of the dex file {@code out} and * writes them to the file. */ public void writeHashes() throws IOException { openSection(SIGNATURE_OFFSET).write(computeSignature(true)); openSection(CHECKSUM_OFFSET).writeInt(computeChecksum()); }
private boolean isSameAnnotation( Dex oldDex, Dex newDex, int oldAnnotationOffset, int newAnnotationOffset ) { Annotation oldAnnotation = oldDex.openSection(oldAnnotationOffset).readAnnotation(); Annotation newAnnotation = newDex.openSection(newAnnotationOffset).readAnnotation(); if (oldAnnotation.visibility != newAnnotation.visibility) { return false; } EncodedValueReader oldAnnoReader = oldAnnotation.getReader(); EncodedValueReader newAnnoReader = newAnnotation.getReader(); return isSameAnnotationByReader(oldDex, newDex, oldAnnoReader, newAnnoReader); }