/** * Gets the index of the given string, which must have been added * to this instance. * * @param string {@code non-null;} the string to look up * @return {@code >= 0;} the string's index */ public int indexOf(CstString string) { return indexOf(string.getString()); }
/** * Emits a string index as an unsigned LEB128. The actual value written * is shifted by 1, so that the '0' value is reserved for "null". The * null symbol is used in some cases by the parameter name list * at the beginning of the sequence. * * @param string {@code null-ok;} string to emit * @throws IOException */ private void emitStringIndex(CstString string) throws IOException { if ((string == null) || (file == null)) { output.writeUleb128(0); } else { output.writeUleb128( 1 + file.getStringIds().indexOf(string)); } if (DEBUG) { System.err.printf("Emit string %s\n", string == null ? "<null>" : string.toQuoted()); } }
/** * Emits a string index as an unsigned LEB128. The actual value written * is shifted by 1, so that the '0' value is reserved for "null". The * null symbol is used in some cases by the parameter name list * at the beginning of the sequence. * * @param string {@code null-ok;} string to emit * @throws IOException */ private void emitStringIndex(CstString string) throws IOException { if ((string == null) || (file == null)) { output.writeUleb128(0); } else { output.writeUleb128( 1 + file.getStringIds().indexOf(string)); } if (DEBUG) { System.err.printf("Emit string %s\n", string == null ? "<null>" : string.toQuoted()); } }
/** * Emits a string index as an unsigned LEB128. The actual value written * is shifted by 1, so that the '0' value is reserved for "null". The * null symbol is used in some cases by the parameter name list * at the beginning of the sequence. * * @param string {@code null-ok;} string to emit * @throws IOException */ private void emitStringIndex(CstString string) throws IOException { if ((string == null) || (file == null)) { output.writeUleb128(0); } else { output.writeUleb128( 1 + file.getStringIds().indexOf(string)); } if (DEBUG) { System.err.printf("Emit string %s\n", string == null ? "<null>" : string.toQuoted()); } }
/** * Emits a string index as an unsigned LEB128. The actual value written * is shifted by 1, so that the '0' value is reserved for "null". The * null symbol is used in some cases by the parameter name list * at the beginning of the sequence. * * @param string {@code null-ok;} string to emit * @throws IOException */ private void emitStringIndex(CstString string) throws IOException { if ((string == null) || (file == null)) { output.writeUleb128(0); } else { output.writeUleb128( 1 + file.getStringIds().indexOf(string)); } if (DEBUG) { System.err.printf("Emit string %s\n", string == null ? "<null>" : string.toQuoted()); } }
/** {@inheritDoc} */ @Override public void writeTo(DexFile file, AnnotatedOutput out) { CstType type = getDefiningClass(); CstString descriptor = type.getDescriptor(); int idx = file.getStringIds().indexOf(descriptor); if (out.annotates()) { out.annotate(0, indexString() + ' ' + descriptor.toHuman()); out.annotate(4, " descriptor_idx: " + Hex.u4(idx)); } out.writeInt(idx); } }
/** {@inheritDoc} */ @Override public void writeTo(DexFile file, AnnotatedOutput out) { CstType type = getDefiningClass(); CstString descriptor = type.getDescriptor(); int idx = file.getStringIds().indexOf(descriptor); if (out.annotates()) { out.annotate(0, indexString() + ' ' + descriptor.toHuman()); out.annotate(4, " descriptor_idx: " + Hex.u4(idx)); } out.writeInt(idx); } }
/** {@inheritDoc} */ @Override public void writeTo(DexFile file, AnnotatedOutput out) { CstType type = getDefiningClass(); CstString descriptor = type.getDescriptor(); int idx = file.getStringIds().indexOf(descriptor); if (out.annotates()) { out.annotate(0, indexString() + ' ' + descriptor.toHuman()); out.annotate(4, " descriptor_idx: " + Hex.u4(idx)); } out.writeInt(idx); } }
/** {@inheritDoc} */ @Override public void writeTo(DexFile file, AnnotatedOutput out) { CstType type = getDefiningClass(); CstString descriptor = type.getDescriptor(); int idx = file.getStringIds().indexOf(descriptor); if (out.annotates()) { out.annotate(0, indexString() + ' ' + descriptor.toHuman()); out.annotate(4, " descriptor_idx: " + Hex.u4(idx)); } out.writeInt(idx); } }
/** {@inheritDoc} */ @Override public void writeTo(DexFile file, AnnotatedOutput out) { CstType type = getDefiningClass(); CstString descriptor = type.getDescriptor(); int idx = file.getStringIds().indexOf(descriptor); if (out.annotates()) { out.annotate(0, indexString() + ' ' + descriptor.toHuman()); out.annotate(4, " descriptor_idx: " + Hex.u4(idx)); } out.writeInt(idx); } }
/** {@inheritDoc} */ @Override public void writeTo(DexFile file, AnnotatedOutput out) { CstType type = getDefiningClass(); CstString descriptor = type.getDescriptor(); int idx = file.getStringIds().indexOf(descriptor); if (out.annotates()) { out.annotate(0, indexString() + ' ' + descriptor.toHuman()); out.annotate(4, " descriptor_idx: " + Hex.u4(idx)); } out.writeInt(idx); } }
/** {@inheritDoc} */ @Override public void writeTo(DexFile file, AnnotatedOutput out) { CstType type = getDefiningClass(); CstString descriptor = type.getDescriptor(); int idx = file.getStringIds().indexOf(descriptor); if (out.annotates()) { out.annotate(0, indexString() + ' ' + descriptor.toHuman()); out.annotate(4, " descriptor_idx: " + Hex.u4(idx)); } out.writeInt(idx); } }
/** {@inheritDoc} */ @Override public void writeTo(DexFile file, AnnotatedOutput out) { CstType type = getDefiningClass(); CstUtf8 descriptor = type.getDescriptor(); int idx = file.getStringIds().indexOf(descriptor); if (out.annotates()) { out.annotate(0, indexString() + ' ' + descriptor.toHuman()); out.annotate(4, " descriptor_idx: " + Hex.u4(idx)); } out.writeInt(idx); } }
/** {@inheritDoc} */ @Override public final void writeTo(DexFile file, AnnotatedOutput out) { TypeIdsSection typeIds = file.getTypeIds(); StringIdsSection stringIds = file.getStringIds(); CstNat nat = cst.getNat(); int classIdx = typeIds.indexOf(getDefiningClass()); int nameIdx = stringIds.indexOf(nat.getName()); int typoidIdx = getTypoidIdx(file); if (out.annotates()) { out.annotate(0, indexString() + ' ' + cst.toHuman()); out.annotate(2, " class_idx: " + Hex.u2(classIdx)); out.annotate(2, String.format(" %-10s %s", getTypoidName() + ':', Hex.u2(typoidIdx))); out.annotate(4, " name_idx: " + Hex.u4(nameIdx)); } out.writeShort(classIdx); out.writeShort(typoidIdx); out.writeInt(nameIdx); }
/** {@inheritDoc} */ @Override public final void writeTo(DexFile file, AnnotatedOutput out) { TypeIdsSection typeIds = file.getTypeIds(); StringIdsSection stringIds = file.getStringIds(); CstNat nat = cst.getNat(); int classIdx = typeIds.indexOf(getDefiningClass()); int nameIdx = stringIds.indexOf(nat.getName()); int typoidIdx = getTypoidIdx(file); if (out.annotates()) { out.annotate(0, indexString() + ' ' + cst.toHuman()); out.annotate(2, " class_idx: " + Hex.u2(classIdx)); out.annotate(2, String.format(" %-10s %s", getTypoidName() + ':', Hex.u2(typoidIdx))); out.annotate(4, " name_idx: " + Hex.u4(nameIdx)); } out.writeShort(classIdx); out.writeShort(typoidIdx); out.writeInt(nameIdx); }
/** {@inheritDoc} */ @Override public final void writeTo(DexFile file, AnnotatedOutput out) { TypeIdsSection typeIds = file.getTypeIds(); StringIdsSection stringIds = file.getStringIds(); CstNat nat = cst.getNat(); int classIdx = typeIds.indexOf(getDefiningClass()); int nameIdx = stringIds.indexOf(nat.getName()); int typoidIdx = getTypoidIdx(file); if (out.annotates()) { out.annotate(0, indexString() + ' ' + cst.toHuman()); out.annotate(2, " class_idx: " + Hex.u2(classIdx)); out.annotate(2, String.format(" %-10s %s", getTypoidName() + ':', Hex.u2(typoidIdx))); out.annotate(4, " name_idx: " + Hex.u4(nameIdx)); } out.writeShort(classIdx); out.writeShort(typoidIdx); out.writeInt(nameIdx); }
/** {@inheritDoc} */ @Override public final void writeTo(DexFile file, AnnotatedOutput out) { TypeIdsSection typeIds = file.getTypeIds(); StringIdsSection stringIds = file.getStringIds(); CstNat nat = cst.getNat(); int classIdx = typeIds.indexOf(getDefiningClass()); int nameIdx = stringIds.indexOf(nat.getName()); int typoidIdx = getTypoidIdx(file); if (out.annotates()) { out.annotate(0, indexString() + ' ' + cst.toHuman()); out.annotate(2, " class_idx: " + Hex.u2(classIdx)); out.annotate(2, String.format(" %-10s %s", getTypoidName() + ':', Hex.u2(typoidIdx))); out.annotate(4, " name_idx: " + Hex.u4(nameIdx)); } out.writeShort(classIdx); out.writeShort(typoidIdx); out.writeInt(nameIdx); }
/** {@inheritDoc} */ @Override public final void writeTo(DexFile file, AnnotatedOutput out) { TypeIdsSection typeIds = file.getTypeIds(); StringIdsSection stringIds = file.getStringIds(); CstNat nat = cst.getNat(); int classIdx = typeIds.indexOf(getDefiningClass()); int nameIdx = stringIds.indexOf(nat.getName()); int typoidIdx = getTypoidIdx(file); if (out.annotates()) { out.annotate(0, indexString() + ' ' + cst.toHuman()); out.annotate(2, " class_idx: " + Hex.u2(classIdx)); out.annotate(2, String.format(" %-10s %s", getTypoidName() + ':', Hex.u2(typoidIdx))); out.annotate(4, " name_idx: " + Hex.u4(nameIdx)); } out.writeShort(classIdx); out.writeShort(typoidIdx); out.writeInt(nameIdx); }
/** {@inheritDoc} */ @Override public final void writeTo(DexFile file, AnnotatedOutput out) { TypeIdsSection typeIds = file.getTypeIds(); StringIdsSection stringIds = file.getStringIds(); CstNat nat = cst.getNat(); int classIdx = typeIds.indexOf(getDefiningClass()); int nameIdx = stringIds.indexOf(nat.getName()); int typoidIdx = getTypoidIdx(file); if (out.annotates()) { out.annotate(0, indexString() + ' ' + cst.toHuman()); out.annotate(2, " class_idx: " + Hex.u2(classIdx)); out.annotate(2, String.format(" %-10s %s", getTypoidName() + ':', Hex.u2(typoidIdx))); out.annotate(4, " name_idx: " + Hex.u4(nameIdx)); } out.writeShort(classIdx); out.writeShort(typoidIdx); out.writeInt(nameIdx); }
/** {@inheritDoc} */ @Override public final void writeTo(DexFile file, AnnotatedOutput out) { TypeIdsSection typeIds = file.getTypeIds(); StringIdsSection stringIds = file.getStringIds(); CstNat nat = cst.getNat(); int classIdx = typeIds.indexOf(getDefiningClass()); int nameIdx = stringIds.indexOf(nat.getName()); int typoidIdx = getTypoidIdx(file); if (out.annotates()) { out.annotate(0, indexString() + ' ' + cst.toHuman()); out.annotate(2, " class_idx: " + Hex.u2(classIdx)); out.annotate(2, String.format(" %-10s %s", getTypoidName() + ':', Hex.u2(typoidIdx))); out.annotate(4, " name_idx: " + Hex.u4(nameIdx)); } out.writeShort(classIdx); out.writeShort(typoidIdx); out.writeInt(nameIdx); }