public void writeStringData(String value) { try { int length = value.length(); writeUleb128(length); write(Mutf8.encode(value)); writeByte(0); } catch (UTFDataFormatException e) { throw new AssertionError(); } }
public void writeHeader(DexBuffer.Section out) throws IOException { out.write(DexFormat.apiToMagic(DexFormat.API_CURRENT).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.off); out.writeInt(typeIds.size); out.writeInt(typeIds.off); out.writeInt(protoIds.size); out.writeInt(protoIds.off); out.writeInt(fieldIds.size); out.writeInt(fieldIds.off); out.writeInt(methodIds.size); out.writeInt(methodIds.off); out.writeInt(classDefs.size); out.writeInt(classDefs.off); out.writeInt(dataSize); out.writeInt(dataOff); }
short[] newInstructions = transformer.transform(instructions); codeOut.writeInt(newInstructions.length); codeOut.write(newInstructions);
public void writeTo(DexBuffer.Section out) { out.write(data); }
/** * Generates the signature and checksum of the dex file {@code out} and * writes them to the file. */ public void writeHashes(DexBuffer dex) throws IOException { byte[] signature = computeSignature(dex); dex.open(SIGNATURE_OFFSET).write(signature); int checksum = computeChecksum(dex); dex.open(CHECKSUM_OFFSET).writeInt(checksum); } }