public abstract class Attribute_info extends Object implements 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| 限定符和类型 | 字段和说明 |
|---|---|
static String |
ATTRIBUTE_BRIDGE |
static String |
ATTRIBUTE_CODE |
static String |
ATTRIBUTE_CONSTANT_VALUE |
static String |
ATTRIBUTE_EXCEPTIONS |
static String |
ATTRIBUTE_INNERCLASSES |
static String |
ATTRIBUTE_LINE_NUMBER_TABLE |
static String |
ATTRIBUTE_SOURCEFILE |
static 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]. |
| 限定符 | 构造器和说明 |
|---|---|
protected |
Attribute_info(int attribute_name_index,
long attribute_length) |
| 限定符和类型 | 方法和说明 |
|---|---|
abstract void |
accept(IAttributeVisitor visitor,
Object ctx) |
Object |
clone()
Chains to super.clone() and removes CloneNotSupportedException
from the method signature.
|
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 String |
toString() |
void |
writeInClassFormat(UDataOutputStream out) |
public int m_name_index
CONSTANT_Utf8_info
string representing the name of this attribute [always positive].protected long m_attribute_length
public String getName(ClassDef cls)
cls - class that contains this attributepublic abstract long length()
public abstract void accept(IAttributeVisitor visitor, Object ctx)
public static Attribute_info new_Attribute_info(IConstantCollection constants, UDataInputStream bytes) throws 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]IOException - on input errorspublic Object clone()
public void writeInClassFormat(UDataOutputStream out) throws IOException
writeInClassFormat 在接口中 IClassFormatOutputIOExceptionCopyright © 2018. All rights reserved.