Class Attribute
🏭 Constructors
constructor
new Attribute(type: null | string): AttributeConstructs a new empty attribute.
Parameters
- type:
null | stringthe type of the attribute.
Return Type
Attribute
Defined in: packages/asm/libs/Attribute.ts:65
🏷️ Properties
next
next: null | Attribute = nullThe next attribute in this attribute list. May be <tt>null</tt>.
Defined in: packages/asm/libs/Attribute.ts:57
type
type: null | stringThe type of this attribute.
Defined in: packages/asm/libs/Attribute.ts:47
value
value: Uint8ArrayThe raw value of this attribute, used only for unknown attributes.
Defined in: packages/asm/libs/Attribute.ts:52
🔧 Methods
getCount
getCount(): numberReturns the length of the attribute list that begins with this attribute.
Return Type
number
Defined in: packages/asm/libs/Attribute.ts:173
getLabels
getLabels(): null | Label[]Returns the labels corresponding to this attribute.
Return Type
null | Label[]
Defined in: packages/asm/libs/Attribute.ts:94
getSize
getSize(cw: ClassWriter, code: null | Uint8Array, len: number, maxStack: number, maxLocals: number): numberReturns the size of all the attributes in this attribute list.
Parameters
- cw:
ClassWriterthe class writer to be used to convert the attributes into byte arrays, with the #write write method. - code:
null | Uint8Arraythe bytecode of the method corresponding to these code attributes, or <tt>null</tt> if these attributes are not code attributes. - len:
numberthe length of the bytecode of the method corresponding to these code attributes, or <tt>null</tt> if these attributes are not code attributes. - maxStack:
numberthe maximum stack size of the method corresponding to these code attributes, or -1 if these attributes are not code attributes. - maxLocals:
numberthe maximum number of local variables of the method corresponding to these code attributes, or -1 if these attributes are not code attributes.
Return Type
number
Defined in: packages/asm/libs/Attribute.ts:208
isCodeAttribute
isCodeAttribute(): booleanReturns <tt>true</tt> if this type of attribute is a code attribute.
Return Type
boolean
Defined in: packages/asm/libs/Attribute.ts:84
isUnknown
isUnknown(): booleanReturns <tt>true</tt> if this type of attribute is unknown. The default implementation of this method always returns <tt>true</tt>.
Return Type
boolean
Defined in: packages/asm/libs/Attribute.ts:75
put
put(cw: ClassWriter, code: null | Uint8Array, len: number, maxStack: number, maxLocals: number, out: ByteVector): voidWrites all the attributes of this attribute list in the given byte vector.
Parameters
- cw:
ClassWriterthe class writer to be used to convert the attributes into byte arrays, with the #write write method. - code:
null | Uint8Arraythe bytecode of the method corresponding to these code attributes, or <tt>null</tt> if these attributes are not code attributes. - len:
numberthe length of the bytecode of the method corresponding to these code attributes, or <tt>null</tt> if these attributes are not code attributes. - maxStack:
numberthe maximum stack size of the method corresponding to these code attributes, or -1 if these attributes are not code attributes. - maxLocals:
numberthe maximum number of local variables of the method corresponding to these code attributes, or -1 if these attributes are not code attributes. - out:
ByteVectorwhere the attributes must be written.
Return Type
void
Defined in: packages/asm/libs/Attribute.ts:246
read
read(cr: ClassReader, off: number, len: number, buf: null | number[], codeOff: number, labels: null | Label[]): AttributeReads a #type type attribute. This method must return a <i>new</i> Attribute object, of type #type type, corresponding to the <tt>len</tt> bytes starting at the given offset, in the given class reader.
Parameters
- cr:
ClassReaderthe class that contains the attribute to be read. - off:
numberindex of the first byte of the attribute's content in [ClassReader#b cr.b]. The 6 attribute header bytes, containing the type and the length of the attribute, are not taken into account here. - len:
numberthe length of the attribute's content. - buf:
null | number[]buffer to be used to call readUTF8, (int,char[]) readClass or readConst. - codeOff:
numberindex of the first byte of code's attribute content in [ClassReader#b cr.b], or -1 if the attribute to be read is not a code attribute. The 6 attribute header bytes, containing the type and the length of the attribute, are not taken into account here. - labels:
null | Label[]the labels of the method's code, or <tt>null</tt> if the attribute to be read is not a code attribute.
Return Type
Attribute
Defined in: packages/asm/libs/Attribute.ts:129
write
write(cw: ClassWriter, code: null | Uint8Array, len: number, maxStack: number, maxLocals: number): ByteVectorReturns the byte array form of this attribute.
Parameters
- cw:
ClassWriterthe class to which this attribute must be added. This parameter can be used to add to the constant pool of this class the items that corresponds to this attribute. - code:
null | Uint8Arraythe bytecode of the method corresponding to this code attribute, or <tt>null</tt> if this attribute is not a code attributes. - len:
numberthe length of the bytecode of the method corresponding to this code attribute, or <tt>null</tt> if this attribute is not a code attribute. - maxStack:
numberthe maximum stack size of the method corresponding to this code attribute, or -1 if this attribute is not a code attribute. - maxLocals:
numberthe maximum number of local variables of the method corresponding to this code attribute, or -1 if this attribute is not a code attribute.
Return Type
ByteVector
Defined in: packages/asm/libs/Attribute.ts:161