|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.vladium.jcd.cls.attribute.Attribute_info
public abstract class Attribute_info
Abstract base for all XXXAttribute_info structures. It also works in conjunction
with 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
Field Summary | |
---|---|
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]. |
Constructor Summary | |
---|---|
protected |
Attribute_info(int attribute_name_index,
long attribute_length)
|
Method Summary | |
---|---|
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)
|
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
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
Constructor Detail |
---|
protected Attribute_info(int attribute_name_index, long attribute_length)
Method Detail |
---|
public java.lang.String getName(ClassDef cls)
cls
- class that contains this attribute
public abstract long length()
public abstract void accept(IAttributeVisitor visitor, java.lang.Object ctx)
public abstract java.lang.String toString()
toString
in class java.lang.Object
public 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.Object
public void writeInClassFormat(UDataOutputStream out) throws java.io.IOException
writeInClassFormat
in interface IClassFormatOutput
java.io.IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |