Package com.ibm.wala.shrikeCT
Class ClassReader.AttrIterator
- java.lang.Object
-
- com.ibm.wala.shrikeCT.ClassReader.AttrIterator
-
- Enclosing class:
- ClassReader
public static final class ClassReader.AttrIterator extends Object
AttrIterator provides access to attributes in the class file. AttrIterators can be reused for many different iterations, like this:AttrIterator iter = new AttrIterator(); int fieldCount = reader.getFieldCount(); for (int i = 0; i < fieldCount; i++) { reader.initFieldAttributeIterator(i, iter); for (; iter.isValid(); iter.advance()) { if (iter.getName().equals("ConstantValue")) { ConstantValueReader cv = new ConstantValueReader(iter); ... } } }
-
-
Constructor Summary
Constructors Constructor Description AttrIterator()
Create a blank iterator.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
advance()
The attribute iterator must be valid.ClassReader
getClassReader()
int
getDataOffset()
The attribute iterator must be valid.int
getDataSize()
The attribute iterator must be valid.String
getName()
The attribute iterator must be valid.int
getNameIndex()
The attribute iterator must be valid.int
getRawOffset()
The attribute iterator must be valid.int
getRawSize()
The attribute iterator must be valid.int
getRemainingAttributesCount()
boolean
isValid()
-
-
-
Method Detail
-
getClassReader
public ClassReader getClassReader()
-
getRawOffset
public int getRawOffset()
The attribute iterator must be valid.- Returns:
- the offset of the raw attribute data (including attribute header) in the class file data
-
getRawSize
public int getRawSize()
The attribute iterator must be valid.- Returns:
- the size of the raw attribute data (including attribute header) in the class file data
-
getDataOffset
public int getDataOffset()
The attribute iterator must be valid.- Returns:
- the offset of the attribute data (excluding attribute header) in the class file data
-
getDataSize
public int getDataSize()
The attribute iterator must be valid.- Returns:
- the size of the attribute data (excluding attribute header) in the class file data
-
getRemainingAttributesCount
public int getRemainingAttributesCount()
- Returns:
- the number of attributes left in the list, including this attribute (if valid)
-
getNameIndex
public int getNameIndex()
The attribute iterator must be valid.- Returns:
- the constant pool index of the name of the attribute
-
getName
public String getName() throws InvalidClassFileException
The attribute iterator must be valid.- Returns:
- the name of the attribute
- Throws:
InvalidClassFileException
-
isValid
public boolean isValid()
- Returns:
- whether this iterator is valid
-
advance
public void advance()
The attribute iterator must be valid. The iterator is advanced to the next attribute (which might not exist, so the iterator might become invalid).
-
-