public abstract class Attribute extends java.lang.Object implements java.lang.Cloneable, Node
ConstantValue
,
SourceFile
,
Code
,
Unknown
,
ExceptionTable
,
LineNumberTable
,
LocalVariableTable
,
InnerClasses
,
Synthetic
,
Deprecated
,
Signature
Modifier and Type | Field and Description |
---|---|
protected ConstantPool |
constant_pool
Deprecated.
(since 6.0) will be made private; do not access directly, use getter/setter
|
protected int |
length
Deprecated.
(since 6.0) (since 6.0) will be made private; do not access directly, use getter/setter
|
protected int |
name_index
Deprecated.
(since 6.0) will be made private; do not access directly, use getter/setter
|
private static java.util.Map<java.lang.String,java.lang.Object> |
readers |
protected byte |
tag
Deprecated.
(since 6.0) will be made private; do not access directly, use getter/setter
|
Modifier | Constructor and Description |
---|---|
protected |
Attribute(byte tag,
int name_index,
int length,
ConstantPool constant_pool) |
Modifier and Type | Method and Description |
---|---|
abstract void |
accept(Visitor v)
Called by objects that are traversing the nodes of the tree implicitely
defined by the contents of a Java class.
|
static void |
addAttributeReader(java.lang.String name,
AttributeReader r)
Deprecated.
(6.0) Use
addAttributeReader(String, UnknownAttributeReader) instead |
static void |
addAttributeReader(java.lang.String name,
UnknownAttributeReader r)
Add an Attribute reader capable of parsing (user-defined) attributes
named "name".
|
java.lang.Object |
clone()
Use copy() if you want to have a deep copy(), i.e., with all references
copied correctly.
|
abstract Attribute |
copy(ConstantPool _constant_pool) |
void |
dump(java.io.DataOutputStream file)
Dump attribute to file stream in binary format.
|
ConstantPool |
getConstantPool() |
int |
getLength() |
java.lang.String |
getName() |
int |
getNameIndex() |
byte |
getTag() |
static Attribute |
readAttribute(java.io.DataInput file,
ConstantPool constant_pool)
Class method reads one attribute from the input data stream.
|
static Attribute |
readAttribute(java.io.DataInputStream file,
ConstantPool constant_pool)
Class method reads one attribute from the input data stream.
|
static void |
removeAttributeReader(java.lang.String name)
Remove attribute reader
|
void |
setConstantPool(ConstantPool constant_pool) |
void |
setLength(int length) |
void |
setNameIndex(int name_index) |
java.lang.String |
toString() |
@Deprecated protected int name_index
@Deprecated protected int length
@Deprecated protected byte tag
@Deprecated protected ConstantPool constant_pool
private static final java.util.Map<java.lang.String,java.lang.Object> readers
protected Attribute(byte tag, int name_index, int length, ConstantPool constant_pool)
public abstract void accept(Visitor v)
public void dump(java.io.DataOutputStream file) throws java.io.IOException
file
- Output file streamjava.io.IOException
@Deprecated public static void addAttributeReader(java.lang.String name, AttributeReader r)
addAttributeReader(String, UnknownAttributeReader)
insteadname
- the name of the attribute as stored in the class filer
- the reader objectpublic static void addAttributeReader(java.lang.String name, UnknownAttributeReader r)
name
- the name of the attribute as stored in the class filer
- the reader objectpublic static void removeAttributeReader(java.lang.String name)
name
- the name of the attribute as stored in the class filepublic static Attribute readAttribute(java.io.DataInputStream file, ConstantPool constant_pool) throws java.io.IOException, ClassFormatException
file
- Input streamconstant_pool
- Array of constantsjava.io.IOException
ClassFormatException
Field
,
Method
public static Attribute readAttribute(java.io.DataInput file, ConstantPool constant_pool) throws java.io.IOException, ClassFormatException
file
- Input streamconstant_pool
- Array of constantsjava.io.IOException
ClassFormatException
Field
,
Method
public java.lang.String getName()
public final int getLength()
public final void setLength(int length)
length
- length in bytes.public final void setNameIndex(int name_index)
name_index
- of attribute.public final int getNameIndex()
public final byte getTag()
public final ConstantPool getConstantPool()
ConstantPool
public final void setConstantPool(ConstantPool constant_pool)
constant_pool
- Constant pool to be used for this object.ConstantPool
public java.lang.Object clone()
clone
in class java.lang.Object
public abstract Attribute copy(ConstantPool _constant_pool)
public java.lang.String toString()
toString
in class java.lang.Object