| java.lang.Object org.objectweb.asm.jip.Attribute
All known Subclasses: org.objectweb.asm.jip.attrs.StackMapTableAttribute, org.objectweb.asm.jip.attrs.StackMapAttribute,
Attribute | public class Attribute (Code) | | A non standard class, field, method or code attribute.
author: Eric Bruneton author: Eugene Kuleshov |
Field Summary | |
Attribute | next The next attribute in this attribute list. | final public String | type The type of this attribute. | byte[] | value The raw value of this attribute, used only for unknown attributes. |
Constructor Summary | |
protected | Attribute(String type) Constructs a new empty attribute. |
Method Summary | |
final int | getCount() Returns the length of the attribute list that begins with this attribute. | protected Label[] | getLabels() Returns the labels corresponding to this attribute. | final int | getSize(ClassWriter cw, byte[] code, int len, int maxStack, int maxLocals) Returns the size of all the attributes in this attribute list.
Parameters: cw - the class writer to be used to convert the attributes into bytearrays, with the Attribute.write write method. Parameters: code - the bytecode of the method corresponding to these codeattributes, or null if these attributes are not codeattributes. Parameters: len - the length of the bytecode of the method corresponding tothese code attributes, or null if these attributes arenot code attributes. Parameters: maxStack - the maximum stack size of the method corresponding tothese code attributes, or -1 if these attributes are not codeattributes. Parameters: maxLocals - the maximum number of local variables of the methodcorresponding to these code attributes, or -1 if these attributesare not code attributes. | public boolean | isCodeAttribute() Returns true if this type of attribute is a code attribute. | public boolean | isUnknown() Returns true if this type of attribute is unknown. | final void | put(ClassWriter cw, byte[] code, int len, int maxStack, int maxLocals, ByteVector out) Writes all the attributes of this attribute list in the given byte
vector. | protected Attribute | read(ClassReader cr, int off, int len, char[] buf, int codeOff, Label[] labels) Reads a
Attribute.type type attribute. | protected ByteVector | write(ClassWriter cw, byte[] code, int len, int maxStack, int maxLocals) Returns the byte array form of this attribute.
Parameters: cw - the class to which this attribute must be added. |
next | Attribute next(Code) | | The next attribute in this attribute list. May be null.
|
type | final public String type(Code) | | The type of this attribute.
|
value | byte[] value(Code) | | The raw value of this attribute, used only for unknown attributes.
|
Attribute | protected Attribute(String type)(Code) | | Constructs a new empty attribute.
Parameters: type - the type of the attribute. |
getCount | final int getCount()(Code) | | Returns the length of the attribute list that begins with this attribute.
the length of the attribute list that begins with this attribute. |
getLabels | protected Label[] getLabels()(Code) | | Returns the labels corresponding to this attribute.
the labels corresponding to this attribute, or null ifthis attribute is not a code attribute that contains labels. |
getSize | final int getSize(ClassWriter cw, byte[] code, int len, int maxStack, int maxLocals)(Code) | | Returns the size of all the attributes in this attribute list.
Parameters: cw - the class writer to be used to convert the attributes into bytearrays, with the Attribute.write write method. Parameters: code - the bytecode of the method corresponding to these codeattributes, or null if these attributes are not codeattributes. Parameters: len - the length of the bytecode of the method corresponding tothese code attributes, or null if these attributes arenot code attributes. Parameters: maxStack - the maximum stack size of the method corresponding tothese code attributes, or -1 if these attributes are not codeattributes. Parameters: maxLocals - the maximum number of local variables of the methodcorresponding to these code attributes, or -1 if these attributesare not code attributes. the size of all the attributes in this attribute list. This sizeincludes the size of the attribute headers. |
isCodeAttribute | public boolean isCodeAttribute()(Code) | | Returns true if this type of attribute is a code attribute.
true if this type of attribute is a code attribute. |
isUnknown | public boolean isUnknown()(Code) | | Returns true if this type of attribute is unknown. The default
implementation of this method always returns true.
true if this type of attribute is unknown. |
put | final void put(ClassWriter cw, byte[] code, int len, int maxStack, int maxLocals, ByteVector out)(Code) | | Writes all the attributes of this attribute list in the given byte
vector.
Parameters: cw - the class writer to be used to convert the attributes into bytearrays, with the Attribute.write write method. Parameters: code - the bytecode of the method corresponding to these codeattributes, or null if these attributes are not codeattributes. Parameters: len - the length of the bytecode of the method corresponding tothese code attributes, or null if these attributes arenot code attributes. Parameters: maxStack - the maximum stack size of the method corresponding tothese code attributes, or -1 if these attributes are not codeattributes. Parameters: maxLocals - the maximum number of local variables of the methodcorresponding to these code attributes, or -1 if these attributesare not code attributes. Parameters: out - where the attributes must be written. |
read | protected Attribute read(ClassReader cr, int off, int len, char[] buf, int codeOff, Label[] labels)(Code) | | Reads a
Attribute.type type attribute. This method must return a new
Attribute object, of type
Attribute.type type , corresponding to
the len bytes starting at the given offset, in the given class
reader.
Parameters: cr - the class that contains the attribute to be read. Parameters: off - index of the first byte of the attribute's content in ClassReader.b cr.b. The 6 attribute header bytes, containing thetype and the length of the attribute, are not taken into accounthere. Parameters: len - the length of the attribute's content. Parameters: buf - buffer to be used to callClassReader.readUTF8 readUTF8,ClassReader.readClass(intchar[]) readClass orClassReader.readConst readConst. Parameters: codeOff - index of the first byte of code's attribute content inClassReader.b cr.b, or -1 if the attribute to be read isnot a code attribute. The 6 attribute header bytes, containing thetype and the length of the attribute, are not taken into accounthere. Parameters: labels - the labels of the method's code, or null if theattribute to be read is not a code attribute. a new Attribute object corresponding to the givenbytes. |
write | protected ByteVector write(ClassWriter cw, byte[] code, int len, int maxStack, int maxLocals)(Code) | | Returns the byte array form of this attribute.
Parameters: cw - the class to which this attribute must be added. This parametercan be used to add to the constant pool of this class the itemsthat corresponds to this attribute. Parameters: code - the bytecode of the method corresponding to this codeattribute, or null if this attribute is not a codeattributes. Parameters: len - the length of the bytecode of the method corresponding to thiscode attribute, or null if this attribute is not a codeattribute. Parameters: maxStack - the maximum stack size of the method corresponding tothis code attribute, or -1 if this attribute is not a codeattribute. Parameters: maxLocals - the maximum number of local variables of the methodcorresponding to this code attribute, or -1 if this attribute isnot a code attribute. the byte array form of this attribute. |
|
|