/** * Interns an element into this instance. * * @param string {@code non-null;} the string to intern, as a constant * @return {@code non-null;} the interned string */ public StringIdItem intern(CstString string) { return intern(new StringIdItem(string)); }
/** * 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) { if (string == null) { throw new NullPointerException("string == null"); } throwIfNotPrepared(); StringIdItem s = strings.get(string); if (s == null) { throw new IllegalArgumentException("not found"); } return s.getIndex(); }
/** * Interns an element into this instance. * * @param string {@code non-null;} the string to intern * @return {@code non-null;} the interned string */ public StringIdItem intern(StringIdItem string) { if (string == null) { throw new NullPointerException("string == null"); } throwIfPrepared(); CstString value = string.getValue(); StringIdItem already = strings.get(value); if (already != null) { return already; } strings.put(value, string); return string; }
/** {@inheritDoc} */ @Override public void writeTo(DexFile file, AnnotatedOutput out) { int dataOff = data.getAbsoluteOffset(); if (out.annotates()) { out.annotate(0, indexString() + ' ' + value.toQuoted(100)); out.annotate(4, " string_data_off: " + Hex.u4(dataOff)); } out.writeInt(dataOff); }
/** {@inheritDoc} */ @Override protected void orderItems() { int idx = 0; for (StringIdItem s : strings.values()) { s.setIndex(idx); idx++; } } }
/** {@inheritDoc} */ @Override public void writeTo(DexFile file, AnnotatedOutput out) { int dataOff = data.getAbsoluteOffset(); if (out.annotates()) { out.annotate(0, indexString() + ' ' + value.toQuoted(100)); out.annotate(4, " string_data_off: " + Hex.u4(dataOff)); } out.writeInt(dataOff); }
/** {@inheritDoc} */ @Override protected void orderItems() { int idx = 0; for (StringIdItem s : strings.values()) { s.setIndex(idx); idx++; } } }
/** * Interns an element into this instance. * * @param string {@code non-null;} the string to intern, as a constant * @return {@code non-null;} the interned string */ public StringIdItem intern(CstString string) { return intern(new StringIdItem(string)); }
/** {@inheritDoc} */ @Override public void writeTo(DexFile file, AnnotatedOutput out) { int dataOff = data.getAbsoluteOffset(); if (out.annotates()) { out.annotate(0, indexString() + ' ' + value.toQuoted(100)); out.annotate(4, " string_data_off: " + Hex.u4(dataOff)); } out.writeInt(dataOff); }
/** {@inheritDoc} */ @Override protected void orderItems() { int idx = 0; for (StringIdItem s : strings.values()) { s.setIndex(idx); idx++; } } }
/** * 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) { if (string == null) { throw new NullPointerException("string == null"); } throwIfNotPrepared(); StringIdItem s = strings.get(string); if (s == null) { throw new IllegalArgumentException("not found"); } return s.getIndex(); }
/** * Interns an element into this instance. * * @param string {@code non-null;} the string to intern * @return {@code non-null;} the interned string */ public synchronized StringIdItem intern(StringIdItem string) { if (string == null) { throw new NullPointerException("string == null"); } throwIfPrepared(); CstString value = string.getValue(); StringIdItem already = strings.get(value); if (already != null) { return already; } strings.put(value, string); return string; }
/** * Interns an element into this instance. * * @param string {@code non-null;} the string to intern, as a constant * @return {@code non-null;} the interned string */ public StringIdItem intern(CstUtf8 string) { return intern(new StringIdItem(string)); }
/** {@inheritDoc} */ @Override public void writeTo(DexFile file, AnnotatedOutput out) { int dataOff = data.getAbsoluteOffset(); if (out.annotates()) { out.annotate(0, indexString() + ' ' + value.toQuoted(100)); out.annotate(4, " string_data_off: " + Hex.u4(dataOff)); } out.writeInt(dataOff); }
/** {@inheritDoc} */ @Override protected void orderItems() { int idx = 0; for (StringIdItem s : strings.values()) { s.setIndex(idx); idx++; } } }
/** * 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) { if (string == null) { throw new NullPointerException("string == null"); } throwIfNotPrepared(); StringIdItem s = strings.get(string); if (s == null) { throw new IllegalArgumentException("not found"); } return s.getIndex(); }
/** * Interns an element into this instance. * * @param string {@code non-null;} the string to intern * @return {@code non-null;} the interned string */ public synchronized StringIdItem intern(StringIdItem string) { if (string == null) { throw new NullPointerException("string == null"); } throwIfPrepared(); CstString value = string.getValue(); StringIdItem already = strings.get(value); if (already != null) { return already; } strings.put(value, string); return string; }
/** * Interns an element into this instance. * * @param string {@code non-null;} the string to intern, as a constant * @return {@code non-null;} the interned string */ public StringIdItem intern(CstString string) { return intern(new StringIdItem(string)); }
/** {@inheritDoc} */ @Override public void writeTo(DexFile file, AnnotatedOutput out) { int dataOff = data.getAbsoluteOffset(); if (out.annotates()) { out.annotate(0, indexString() + ' ' + value.toQuoted(100)); out.annotate(4, " string_data_off: " + Hex.u4(dataOff)); } out.writeInt(dataOff); }
/** {@inheritDoc} */ @Override protected void orderItems() { int idx = 0; for (StringIdItem s : strings.values()) { s.setIndex(idx); idx++; } } }