Package org.apache.bcel.classfile
Class Record
java.lang.Object
org.apache.bcel.classfile.Attribute
org.apache.bcel.classfile.Record
Extends
Attribute and records the classes and
interfaces that are authorized to claim membership in the nest hosted by the
current class or interface. There may be at most one Record attribute in a
ClassFile structure.- Since:
- 6.9.0
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate RecordComponentInfo[]private static final RecordComponentInfo[]Fields inherited from class org.apache.bcel.classfile.Attribute
constant_pool, EMPTY_ARRAY, length, name_index, tag -
Constructor Summary
ConstructorsConstructorDescriptionRecord(int nameIndex, int length, DataInput input, ConstantPool constantPool) Constructs a Record attribute from a data input using standard Code headers for nested attributes.Record(int nameIndex, int length, DataInput input, ConstantPool constantPool, boolean compactCodeHeader) Constructs a Record attribute from a data input using the selected Code header layout for nested attributes.Record(int nameIndex, int length, RecordComponentInfo[] classes, ConstantPool constantPool) Constructs a new instance using components. -
Method Summary
Modifier and TypeMethodDescriptionvoidCalled by objects that are traversing the nodes of the tree implicitly defined by the contents of a Java class.copy(ConstantPool constantPool) Copies this instance and its components.voiddump(DataOutputStream file) Dumps this instance into a file stream in binary format.Gets all the record components.private static RecordComponentInfo[]readComponents(DataInput input, ConstantPool constantPool, boolean compactCodeHeader) toString()Converts this instance to a String suitable for debugging.Methods inherited from class org.apache.bcel.classfile.Attribute
addAttributeReader, addAttributeReader, clone, getConstantPool, getLength, getName, getNameIndex, getTag, println, readAttribute, readAttribute, readAttribute, removeAttributeReader, setConstantPool, setLength, setNameIndex
-
Field Details
-
EMPTY_RCI_ARRAY
-
components
-
-
Constructor Details
-
Record
Record(int nameIndex, int length, DataInput input, ConstantPool constantPool) throws IOException Constructs a Record attribute from a data input using standard Code headers for nested attributes.- Parameters:
nameIndex- Constant pool index of the attribute name.length- Content length in bytes.input- Input stream.constantPool- The constant pool.- Throws:
IOException- Thrown if an I/O error occurs.ClassFormatException- Thrown if the attribute or one of its components is malformed.
-
Record
Record(int nameIndex, int length, DataInput input, ConstantPool constantPool, boolean compactCodeHeader) throws IOException Constructs a Record attribute from a data input using the selected Code header layout for nested attributes.The header selection is forwarded when reading component attributes; it does not change the Record attribute or record component layout.
- Parameters:
nameIndex- Constant pool index of the attribute name.length- Content length in bytes.input- Input stream.constantPool- The constant pool.compactCodeHeader- Whether to read any Code attributes encountered with compact four-byte headers (true) or standard eight-byte headers (false).- Throws:
IOException- Thrown if an I/O error occurs.ClassFormatException- Thrown if the attribute or one of its components is malformed.- See Also:
-
Record
Constructs a new instance using components.- Parameters:
nameIndex- Index in constant pool.length- Content length in bytes.classes- Array of Record Component Info elements.constantPool- Array of constants.
-
-
Method Details
-
readComponents
private static RecordComponentInfo[] readComponents(DataInput input, ConstantPool constantPool, boolean compactCodeHeader) throws IOException - Throws:
IOException
-
accept
Called by objects that are traversing the nodes of the tree implicitly defined by the contents of a Java class. For example, the hierarchy of methods, fields, attributes, and other elements forms a tree of objects. -
copy
Copies this instance and its components. -
dump
Dumps this instance into a file stream in binary format.- Overrides:
dumpin classAttribute- Parameters:
file- output stream.- Throws:
IOException- Thrown if an I/O error occurs.
-
getComponents
Gets all the record components.- Returns:
- array of Record Component Info elements.
-
toString
Converts this instance to a String suitable for debugging.
-