Package com.android.dx.cf.iface
Class StdAttributeList
java.lang.Object
com.android.dx.util.MutabilityControl
com.android.dx.util.FixedSizeList
com.android.dx.cf.iface.StdAttributeList
- All Implemented Interfaces:
AttributeList
,ToHuman
Standard implementation of
AttributeList
, which directly stores
an array of Attribute
objects and can be made immutable.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
Get the total length of this list in bytes, when part of a class file.Get the first attribute in the list with the given name, if any.Get the next attribute in the list after the given one, with the same name, if any.get
(int n) Get then
th attribute.void
Sets the attribute at the given index.Methods inherited from class com.android.dx.util.FixedSizeList
equals, get0, getOrNull0, hashCode, set0, shrinkToFit, size, toHuman, toHuman, toString, toString
Methods inherited from class com.android.dx.util.MutabilityControl
isImmutable, isMutable, setImmutable, throwIfImmutable, throwIfMutable
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.android.dx.cf.iface.AttributeList
isMutable, size
-
Constructor Details
-
StdAttributeList
public StdAttributeList(int size) Constructs an instance. All indices initially containnull
.- Parameters:
size
- the size of the list
-
-
Method Details
-
get
Get then
th attribute.- Specified by:
get
in interfaceAttributeList
- Parameters:
n
-n >= 0, n < size();
which attribute- Returns:
non-null;
the attribute in question
-
byteLength
public int byteLength()Get the total length of this list in bytes, when part of a class file. The returned value includes the two bytes for theattributes_count
length indicator.- Specified by:
byteLength
in interfaceAttributeList
- Returns:
>= 2;
the total length, in bytes
-
findFirst
Get the first attribute in the list with the given name, if any.- Specified by:
findFirst
in interfaceAttributeList
- Parameters:
name
-non-null;
attribute name- Returns:
null-ok;
first attribute in the list with the given name, ornull
if there is none
-
findNext
Get the next attribute in the list after the given one, with the same name, if any.- Specified by:
findNext
in interfaceAttributeList
- Parameters:
attrib
-non-null;
attribute to start looking after- Returns:
null-ok;
next attribute afterattrib
with the same name asattrib
-
set
Sets the attribute at the given index.- Parameters:
n
->= 0, < size();
which attributeattribute
-null-ok;
the attribute object
-