Package org.apache.bcel.classfile
Class Unknown
java.lang.Object
org.apache.bcel.classfile.Attribute
org.apache.bcel.classfile.Unknown
This class represents a reference to an unknown (i.e., application-specific) attribute of a class. It is instantiated
from the
Attribute.readAttribute(java.io.DataInput, ConstantPool)
method. Applications that need to read in
application-specific attributes should create an UnknownAttributeReader
implementation and attach it via
Attribute.addAttributeReader(String, UnknownAttributeReader)
.- See Also:
-
Field Summary
Fields inherited from class org.apache.bcel.classfile.Attribute
constant_pool, EMPTY_ARRAY, length, name_index, tag
-
Constructor Summary
ConstructorDescriptionUnknown
(int nameIndex, int length, byte[] bytes, ConstantPool constantPool) Constructs a new instance for a non-standard attribute.Constructs a new instance from another instance. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Called by objects that are traversing the nodes of the tree implicitly defined by the contents of a Java class.copy
(ConstantPool constantPool) void
dump
(DataOutputStream file) Dumps unknown bytes to file stream.byte[]
getBytes()
getName()
void
setBytes
(byte[] bytes) toString()
Methods inherited from class org.apache.bcel.classfile.Attribute
addAttributeReader, addAttributeReader, clone, getConstantPool, getLength, getNameIndex, getTag, println, readAttribute, readAttribute, removeAttributeReader, setConstantPool, setLength, setNameIndex
-
Constructor Details
-
Unknown
Constructs a new instance for a non-standard attribute.- Parameters:
nameIndex
- Index in constant poollength
- Content length in bytesbytes
- Attribute contentsconstantPool
- Array of constants
-
Unknown
Constructs a new instance from another instance. Note that both objects use the same references (shallow copy). Use clone() for a physical copy.- Parameters:
unknown
- Source.
-
-
Method Details
-
accept
Called by objects that are traversing the nodes of the tree implicitly defined by the contents of a Java class. I.e., the hierarchy of methods, fields, attributes, etc. spawns a tree of objects. -
copy
-
dump
Dumps unknown bytes to file stream.- Overrides:
dump
in classAttribute
- Parameters:
file
- Output file stream- Throws:
IOException
- if an I/O error occurs.
-
getBytes
- Returns:
- data bytes.
-
getName
-
setBytes
- Parameters:
bytes
- the bytes to set
-
toString
-