Class Attribute
java.lang.Object
EDU.purdue.cs.bloat.file.Attribute
- Direct Known Subclasses:
Code, ConstantValue, Exceptions, GenericAttribute, LineNumberTable, LocalVariableTable
Attribute is an abstract class for an attribute defined for a method, field,
or class. An attribute consists of its name (represented as an index into the
constant pool) and its length. Attribute is extended to represent a constant
value, code, exceptions, etc.
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionclone()intlength()Returns the length of the attribute, excluding the header.intReturns the index into the constant pool of the name of the attribute.toString()Returns a string representation of the attribute.abstract voidWrite the attribute to a data stream.
-
Field Details
-
nameIndex
protected int nameIndex -
length
protected int length
-
-
Constructor Details
-
Attribute
public Attribute(int nameIndex, int length) Constructor.- Parameters:
nameIndex- The index into the constant pool of the name of the attribute.length- The length of the attribute, excluding the header.
-
-
Method Details
-
writeData
Write the attribute to a data stream.- Parameters:
out- The data stream of the class file.- Throws:
IOException
-
toString
-
nameIndex
public int nameIndex()Returns the index into the constant pool of the name of the attribute. -
length
public int length()Returns the length of the attribute, excluding the header. -
clone
-