com.ibm.wala.shrikeCT
Class AttributeReader

java.lang.Object
  extended by com.ibm.wala.shrikeCT.AttributeReader
Direct Known Subclasses:
CodeReader, ConstantValueReader, ExceptionsReader, InnerClassesReader, LineNumberTableReader, LocalVariableTableReader, RuntimeInvisibleAnnotationsReader, SignatureReader, SourceDebugExtensionReader, SourceFileReader

public abstract class AttributeReader
extends java.lang.Object

This is a base class for "attribute readers", the classes which provide access to the contents of attributes.


Field Summary
protected  int attr
           
protected  ClassReader cr
           
protected  int length
           
 
Constructor Summary
protected AttributeReader(ClassReader.AttrIterator attr, java.lang.String expectedName)
          Construct a reader for a particular attribute.
 
Method Summary
protected  void checkSize(int offset, int len)
          Ensure that the len bytes starting at offset fall within the attribute data.
protected  void checkSizeEquals(int offset, int len)
          Ensure that the len bytes starting at offset end at the end of the attribute data.
 ClassReader getClassReader()
           
 int getRawOffset()
           
 int getRawSize()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

cr

protected final ClassReader cr

attr

protected final int attr

length

protected final int length
Constructor Detail

AttributeReader

protected AttributeReader(ClassReader.AttrIterator attr,
                          java.lang.String expectedName)
                   throws InvalidClassFileException
Construct a reader for a particular attribute.

Parameters:
attr - a valid attribute iterator pointing at the attribute to read
expectedName - the name the attribute must have
Throws:
InvalidClassFileException
Method Detail

getClassReader

public final ClassReader getClassReader()
Returns:
the class reader the attribute belongs to

getRawOffset

public final int getRawOffset()
Returns:
the offset of the raw attribute data (including the attribute header)

getRawSize

public final int getRawSize()
Returns:
the size of the raw attribute data (including the attribute header)

checkSize

protected final void checkSize(int offset,
                               int len)
                        throws InvalidClassFileException
Ensure that the len bytes starting at offset fall within the attribute data.

Throws:
InvalidClassFileException - if the bytes fall outside the data

checkSizeEquals

protected final void checkSizeEquals(int offset,
                                     int len)
                              throws InvalidClassFileException
Ensure that the len bytes starting at offset end at the end of the attribute data.

Throws:
InvalidClassFileException - if the bytes do not end at the end of the attribute