public abstract class Attribute_info extends java.lang.Object implements java.lang.Cloneable, IClassFormatOutput
GenericAttribute_info class to process all unrecognized attributes.
Attributes are used in the ClassDef, Field_info,
Method_info, and CodeAttribute_info
structures of the .class file format. All attributes have the following
general format:
attribute_info {
u2 attribute_name_index;
u4 attribute_length;
u1 info[attribute_length];
}
For all attributes, the attribute_name_index must be a valid unsigned 16-bit
index into the constant pool of the class. The constant pool entry at
attribute_name_index must be a CONSTANT_Utf8_info
string representing the name of the attribute. The value of the attribute_length
item indicates the length of the subsequent information in bytes. The length
does not include the initial six bytes that contain the attribute_name_index
and attribute_length items.GenericAttribute_info| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
ATTRIBUTE_BRIDGE |
static java.lang.String |
ATTRIBUTE_CODE |
static java.lang.String |
ATTRIBUTE_CONSTANT_VALUE |
static java.lang.String |
ATTRIBUTE_EXCEPTIONS |
static java.lang.String |
ATTRIBUTE_INNERCLASSES |
static java.lang.String |
ATTRIBUTE_LINE_NUMBER_TABLE |
static java.lang.String |
ATTRIBUTE_SOURCEFILE |
static java.lang.String |
ATTRIBUTE_SYNTHETIC |
protected long |
m_attribute_length |
int |
m_name_index
Constant pool index for
CONSTANT_Utf8_info
string representing the name of this attribute [always positive]. |
| Modifier | Constructor and Description |
|---|---|
protected |
Attribute_info(int attribute_name_index,
long attribute_length) |
| Modifier and Type | Method and Description |
|---|---|
abstract void |
accept(IAttributeVisitor visitor,
java.lang.Object ctx) |
java.lang.Object |
clone()
Chains to super.clone() and removes CloneNotSupportedException
from the method signature.
|
java.lang.String |
getName(ClassDef cls)
Returns the name for this attribute within the constant pool context of 'cls'
class definition.
|
abstract long |
length()
Returns the total length of this attribute when converted to
.class format [including the 6-byte header]
|
static Attribute_info |
new_Attribute_info(IConstantCollection constants,
UDataInputStream bytes)
Parses out a single Attribute_info element out of .class data in
'bytes'.
|
abstract java.lang.String |
toString() |
void |
writeInClassFormat(UDataOutputStream out) |
public static final java.lang.String ATTRIBUTE_CODE
public static final java.lang.String ATTRIBUTE_CONSTANT_VALUE
public static final java.lang.String ATTRIBUTE_LINE_NUMBER_TABLE
public static final java.lang.String ATTRIBUTE_EXCEPTIONS
public static final java.lang.String ATTRIBUTE_SYNTHETIC
public static final java.lang.String ATTRIBUTE_BRIDGE
public static final java.lang.String ATTRIBUTE_SOURCEFILE
public static final java.lang.String ATTRIBUTE_INNERCLASSES
public int m_name_index
CONSTANT_Utf8_info
string representing the name of this attribute [always positive].protected long m_attribute_length
protected Attribute_info(int attribute_name_index,
long attribute_length)
public java.lang.String getName(ClassDef cls)
cls - class that contains this attributepublic abstract long length()
public abstract void accept(IAttributeVisitor visitor, java.lang.Object ctx)
public abstract java.lang.String toString()
toString in class java.lang.Objectpublic static Attribute_info new_Attribute_info(IConstantCollection constants, UDataInputStream bytes) throws java.io.IOException
constants - constant pool for the parent class [may not be null; not validated]bytes - input .class data stream [may not be null; not validated]java.io.IOException - on input errorspublic java.lang.Object clone()
clone in class java.lang.Objectpublic void writeInClassFormat(UDataOutputStream out) throws java.io.IOException
writeInClassFormat in interface IClassFormatOutputjava.io.IOException