Class Attribute
🏭 Constructors
constructor
new Attribute(type: null | string): Attribute
Constructs a new empty attribute.
Parameters
- type:
null | string
the type of the attribute.
Return Type
Attribute
Defined in: packages/asm/libs/Attribute.ts:65
🏷️ Properties
next
next: null | Attribute = null
The next attribute in this attribute list. May be <tt>null</tt>.
Defined in: packages/asm/libs/Attribute.ts:57
type
type: null | string
The type of this attribute.
Defined in: packages/asm/libs/Attribute.ts:47
value
value: Uint8Array
The raw value of this attribute, used only for unknown attributes.
Defined in: packages/asm/libs/Attribute.ts:52
🔧 Methods
getCount
getCount(): number
Returns 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): number
Returns the size of all the attributes in this attribute list.
Parameters
- cw:
ClassWriter
the class writer to be used to convert the attributes into byte arrays, with the #write write method. - code:
null | Uint8Array
the bytecode of the method corresponding to these code attributes, or <tt>null</tt> if these attributes are not code attributes. - len:
number
the length of the bytecode of the method corresponding to these code attributes, or <tt>null</tt> if these attributes are not code attributes. - maxStack:
number
the maximum stack size of the method corresponding to these code attributes, or -1 if these attributes are not code attributes. - maxLocals:
number
the 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(): boolean
Returns <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(): boolean
Returns <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): void
Writes all the attributes of this attribute list in the given byte vector.
Parameters
- cw:
ClassWriter
the class writer to be used to convert the attributes into byte arrays, with the #write write method. - code:
null | Uint8Array
the bytecode of the method corresponding to these code attributes, or <tt>null</tt> if these attributes are not code attributes. - len:
number
the length of the bytecode of the method corresponding to these code attributes, or <tt>null</tt> if these attributes are not code attributes. - maxStack:
number
the maximum stack size of the method corresponding to these code attributes, or -1 if these attributes are not code attributes. - maxLocals:
number
the maximum number of local variables of the method corresponding to these code attributes, or -1 if these attributes are not code attributes. - out:
ByteVector
where 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[]): Attribute
Reads 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:
ClassReader
the class that contains the attribute to be read. - off:
number
index 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:
number
the length of the attribute's content. - buf:
null | number[]
buffer to be used to call readUTF8, (int,char[]) readClass or readConst. - codeOff:
number
index 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): ByteVector
Returns the byte array form of this attribute.
Parameters
- cw:
ClassWriter
the 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 | Uint8Array
the bytecode of the method corresponding to this code attribute, or <tt>null</tt> if this attribute is not a code attributes. - len:
number
the 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:
number
the maximum stack size of the method corresponding to this code attribute, or -1 if this attribute is not a code attribute. - maxLocals:
number
the 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