Methods Summary |
---|
public void | addContents(DexFile file){@inheritDoc}
StringIdsSection stringIds = file.getStringIds();
TypeIdsSection typeIds = file.getTypeIds();
MixedItemSection typeLists = file.getTypeLists();
typeIds.intern(prototype.getReturnType());
stringIds.intern(shortForm);
if (parameterTypes != null) {
parameterTypes = typeLists.intern(parameterTypes);
}
|
public ItemType | itemType(){@inheritDoc}
return ItemType.TYPE_PROTO_ID_ITEM;
|
private static com.android.dexgen.rop.cst.CstUtf8 | makeShortForm(com.android.dexgen.rop.type.Prototype prototype)Creates the short-form of the given prototype.
StdTypeList parameters = prototype.getParameterTypes();
int size = parameters.size();
StringBuilder sb = new StringBuilder(size + 1);
sb.append(shortFormCharFor(prototype.getReturnType()));
for (int i = 0; i < size; i++) {
sb.append(shortFormCharFor(parameters.getType(i)));
}
return new CstUtf8(sb.toString());
|
private static char | shortFormCharFor(com.android.dexgen.rop.type.Type type)Gets the short-form character for the given type.
char descriptorChar = type.getDescriptor().charAt(0);
if (descriptorChar == '[") {
return 'L";
}
return descriptorChar;
|
public int | writeSize(){@inheritDoc}
return WRITE_SIZE;
|
public void | writeTo(DexFile file, com.android.dexgen.util.AnnotatedOutput out){@inheritDoc}
int shortyIdx = file.getStringIds().indexOf(shortForm);
int returnIdx = file.getTypeIds().indexOf(prototype.getReturnType());
int paramsOff = OffsettedItem.getAbsoluteOffsetOr0(parameterTypes);
if (out.annotates()) {
StringBuilder sb = new StringBuilder();
sb.append(prototype.getReturnType().toHuman());
sb.append(" proto(");
StdTypeList params = prototype.getParameterTypes();
int size = params.size();
for (int i = 0; i < size; i++) {
if (i != 0) {
sb.append(", ");
}
sb.append(params.getType(i).toHuman());
}
sb.append(")");
out.annotate(0, indexString() + ' " + sb.toString());
out.annotate(4, " shorty_idx: " + Hex.u4(shortyIdx) +
" // " + shortForm.toQuoted());
out.annotate(4, " return_type_idx: " + Hex.u4(returnIdx) +
" // " + prototype.getReturnType().toHuman());
out.annotate(4, " parameters_off: " + Hex.u4(paramsOff));
}
out.writeInt(shortyIdx);
out.writeInt(returnIdx);
out.writeInt(paramsOff);
|