Package com.ibm.wala.shrike.shrikeCT
Class ClassReader.AttrIterator
- java.lang.Object
-
- com.ibm.wala.shrike.shrikeCT.ClassReader.AttrIterator
-
- Enclosing class:
- ClassReader
public static final class ClassReader.AttrIterator extends java.lang.ObjectAttrIterator 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 voidadvance()The attribute iterator must be valid.ClassReadergetClassReader()intgetDataOffset()The attribute iterator must be valid.intgetDataSize()The attribute iterator must be valid.java.lang.StringgetName()The attribute iterator must be valid.intgetNameIndex()The attribute iterator must be valid.intgetRawOffset()The attribute iterator must be valid.intgetRawSize()The attribute iterator must be valid.intgetRemainingAttributesCount()booleanisValid()
-
-
-
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 java.lang.String getName() throws InvalidClassFileExceptionThe 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).
-
-