Abstract super class for Attribute objects. Currently the
ConstantValue, SourceFile, Code,
Exceptiontable, LineNumberTable,
LocalVariableTable, InnerClasses and
Synthetic attributes are supported. The
Unknown attribute stands for non-standard-attributes.
Called by objects that are traversing the nodes of the tree implicitely
defined by the contents of a Java class. I.e., the hierarchy of methods,
fields, attributes, etc. spawns a tree of objects.
public void dump(java.io.DataOutputStream file)
throws java.io.IOException
Dump attribute to file stream in binary format.
Parameters:
file - Output file stream
addAttributeReader
public static void addAttributeReader(java.lang.String name,
AttributeReader r)
Add an Attribute reader capable of parsing (user-defined) attributes
named "name". You should not add readers for the standard attributes
such as "LineNumberTable", because those are handled internally.
Parameters:
name - the name of the attribute as stored in the class file
r - the reader object
removeAttributeReader
public static void removeAttributeReader(java.lang.String name)
Remove attribute reader
Parameters:
name - the name of the attribute as stored in the class file
getLength
public final int getLength()
Returns:
Length of attribute field in bytes.
setLength
public final void setLength(int length)
Parameters:
Attribute - length in bytes.
setNameIndex
public final void setNameIndex(int name_index)
Parameters:
name_index - of attribute.
getNameIndex
public final int getNameIndex()
Returns:
Name index in constant pool of attribute name.
getTag
public final byte getTag()
Returns:
Tag of attribute, i.e., its type. Value may not be altered, thus
there is no setTag() method.