- All Superinterfaces:
Attribute<CodeAttribute>,AttributedElement,ClassfileElement,CodeModel,CompoundElement<CodeElement>,Iterable<CodeElement>,MethodElement,WritableElement<CodeAttribute>
- All Known Implementing Classes:
BoundAttribute.BoundCodeAttribute,CodeImpl
public sealed interface CodeAttribute
extends Attribute<CodeAttribute>, CodeModel
permits BoundAttribute.BoundCodeAttribute
Models the
Code attribute , appears on non-native,
non-abstract methods and contains the bytecode of the method body. Delivered
as a MethodElement when traversing the elements of a
MethodModel.-
Method Summary
Modifier and TypeMethodDescriptionbyte[]Returns the bytes (bytecode) of the code array.intReturns The length of the code array in bytes.intlabelToBci(Label label) Returns the position of theLabelin thecodeArrayor -1 if theLabeldoes not point to thecodeArray.Methods inherited from interface org.glavo.classfile.Attribute
attributeMapper, attributeNameMethods inherited from interface org.glavo.classfile.AttributedElement
attributes, findAttribute, findAttributesMethods inherited from interface org.glavo.classfile.CodeModel
exceptionHandlers, maxLocals, maxStack, parentMethods inherited from interface org.glavo.classfile.CompoundElement
elementList, elements, elementStream, forEachElement, iteratorMethods inherited from interface java.lang.Iterable
forEach, spliteratorMethods inherited from interface org.glavo.classfile.WritableElement
writeTo
-
Method Details
-
codeLength
int codeLength()Returns The length of the code array in bytes.- Returns:
- The length of the code array in bytes
-
codeArray
byte[] codeArray()Returns the bytes (bytecode) of the code array.- Returns:
- the bytes (bytecode) of the code array
-
labelToBci
Returns the position of theLabelin thecodeArrayor -1 if theLabeldoes not point to thecodeArray.- Parameters:
label- a marker for a position within thisCodeAttribute- Returns:
- the position of the
Labelin thecodeArrayor -1 if theLabeldoes not point to thecodeArray
-