Methods Summary |
---|
public void | addContents(DexFile file){@inheritDoc}
for (OffsettedItem i : items) {
i.addContents(file);
}
|
private static int | getAlignment(java.util.List items)Helper for {@link #UniformListItem}, which returns the alignment
requirement implied by the given list. See the header comment for
more details.
try {
// Since they all must have the same alignment, any one will do.
return Math.max(HEADER_SIZE, items.get(0).getAlignment());
} catch (IndexOutOfBoundsException ex) {
// Translate the exception.
throw new IllegalArgumentException("items.size() == 0");
} catch (NullPointerException ex) {
// Translate the exception.
throw new NullPointerException("items == null");
}
|
public final java.util.List | getItems()Gets the underlying list of items.
return items;
|
private int | headerSize()Get the size of the header of this list.
/*
* Because of how this instance was set up, this is the same
* as the alignment.
*/
return getAlignment();
|
public ItemType | itemType(){@inheritDoc}
return itemType;
|
protected void | place0(Section addedTo, int offset){@inheritDoc}
offset += headerSize();
boolean first = true;
int theSize = -1;
int theAlignment = -1;
for (OffsettedItem i : items) {
int size = i.writeSize();
if (first) {
theSize = size;
theAlignment = i.getAlignment();
first = false;
} else {
if (size != theSize) {
throw new UnsupportedOperationException(
"item size mismatch");
}
if (i.getAlignment() != theAlignment) {
throw new UnsupportedOperationException(
"item alignment mismatch");
}
}
offset = i.place(addedTo, offset) + size;
}
|
public final java.lang.String | toHuman(){@inheritDoc}
StringBuffer sb = new StringBuffer(100);
boolean first = true;
sb.append("{");
for (OffsettedItem i : items) {
if (first) {
first = false;
} else {
sb.append(", ");
}
sb.append(i.toHuman());
}
sb.append("}");
return sb.toString();
|
public java.lang.String | toString(){@inheritDoc}
StringBuffer sb = new StringBuffer(100);
sb.append(getClass().getName());
sb.append(items);
return sb.toString();
|
private static int | writeSize(java.util.List items)Calculates the write size for the given list.
/*
* This class assumes all included items are the same size,
* an assumption which is verified in place0().
*/
OffsettedItem first = items.get(0);
return (items.size() * first.writeSize()) + getAlignment(items);
|
protected void | writeTo0(DexFile file, com.android.dx.util.AnnotatedOutput out){@inheritDoc}
int size = items.size();
if (out.annotates()) {
out.annotate(0, offsetString() + " " + typeName());
out.annotate(4, " size: " + Hex.u4(size));
}
out.writeInt(size);
for (OffsettedItem i : items) {
i.writeTo(file, out);
}
|