public void writeHeader(Dex.Section out) throws IOException { out.write(DexFormat.apiToMagic(DexFormat.API_NO_EXTENDED_OPCODES).getBytes("UTF-8")); out.writeInt(checksum); out.write(signature); out.writeInt(fileSize); out.writeInt(SizeOf.HEADER_ITEM); out.writeInt(DexFormat.ENDIAN_TAG); out.writeInt(linkSize); out.writeInt(linkOff); out.writeInt(mapList.off); out.writeInt(stringIds.size); out.writeInt((stringIds.exists() ? stringIds.off : 0)); out.writeInt(typeIds.size); out.writeInt((typeIds.exists() ? typeIds.off : 0)); out.writeInt(protoIds.size); out.writeInt((protoIds.exists() ? protoIds.off : 0)); out.writeInt(fieldIds.size); out.writeInt((fieldIds.exists() ? fieldIds.off : 0)); out.writeInt(methodIds.size); out.writeInt((methodIds.exists() ? methodIds.off : 0)); out.writeInt(classDefs.size); out.writeInt((classDefs.exists() ? classDefs.off : 0)); out.writeInt(dataSize); out.writeInt(dataOff); }
public void writeHeader(Dex.Section out) throws IOException { out.write(DexFormat.apiToMagic(DexFormat.API_NO_EXTENDED_OPCODES).getBytes("UTF-8")); out.writeInt(checksum); out.write(signature); out.writeInt(fileSize); out.writeInt(SizeOf.HEADER_ITEM); out.writeInt(DexFormat.ENDIAN_TAG); out.writeInt(linkSize); out.writeInt(linkOff); out.writeInt(mapList.off); out.writeInt(stringIds.size); out.writeInt((stringIds.exists() ? stringIds.off : 0)); out.writeInt(typeIds.size); out.writeInt((typeIds.exists() ? typeIds.off : 0)); out.writeInt(protoIds.size); out.writeInt((protoIds.exists() ? protoIds.off : 0)); out.writeInt(fieldIds.size); out.writeInt((fieldIds.exists() ? fieldIds.off : 0)); out.writeInt(methodIds.size); out.writeInt((methodIds.exists() ? methodIds.off : 0)); out.writeInt(classDefs.size); out.writeInt((classDefs.exists() ? classDefs.off : 0)); out.writeInt(dataSize); out.writeInt(dataOff); }
public void writeMap(Dex.Section out) throws IOException { int count = 0; for (Section section : sections) { if (section.exists()) { count++; } } out.writeInt(count); for (Section section : sections) { if (section.exists()) { out.writeShort(section.type); out.writeShort((short) 0); out.writeInt(section.size); out.writeInt(section.off); } } }
/** * 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()); }
@Override protected int writePatchedItem(Integer patchedItem) { int off = this.patchedTypeIdSec.position(); this.patchedTypeIdSec.writeInt(patchedItem); ++this.patchedTypeIdTocSec.size; return off; }
@Override protected int writePatchedItem(StringData patchedItem) { int off = this.patchedStringDataSec.writeStringData(patchedItem); this.patchedStringIdSec.writeInt(off); ++this.patchedStringDataTocSec.size; ++this.patchedStringIdTocSec.size; return off; }
public void writeMap(Dex.Section out) throws IOException { int count = 0; for (Section section : sections) { if (section.exists()) { count++; } } out.writeInt(count); for (Section section : sections) { if (section.exists()) { out.writeShort(section.type); out.writeShort((short) 0); out.writeInt(section.size); out.writeInt(section.off); } } }
@Override protected int writePatchedItem(StringData patchedItem) { int off = this.patchedStringDataSec.writeStringData(patchedItem); this.patchedStringIdSec.writeInt(off); ++this.patchedStringDataTocSec.size; ++this.patchedStringIdTocSec.size; return off; }
/** * 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()); }
@Override protected int writePatchedItem(Integer patchedItem) { int off = this.patchedTypeIdSec.position(); this.patchedTypeIdSec.writeInt(patchedItem); ++this.patchedTypeIdTocSec.size; return off; }