net.sf.transjvm.jvm
Class Attribute

java.lang.Object
  extended by net.sf.transjvm.jvm.Attribute
Direct Known Subclasses:
CodeAttribute, LineNumberTable, LocalVariableTable, SourceFileAttribute, SyntheticAttribute

public abstract class Attribute
extends java.lang.Object

Base class for attributes. All attributes are written to the class file as:

   short attributeNameRef;
    int attributeLength;
    byte attributeData[attributeLength];
Subclasses are responsible for writing the AttributeData.


Constructor Summary
protected Attribute(java.lang.String name)
          Constructor for the Attribute object.
 
Method Summary
 java.lang.String getName()
          Returns the name of this Attribute.
 void write(ByteStream stream, ConstantPool pool)
          Writes this Attribute to the stream.
protected abstract  void writeData(ByteStream stream, ConstantPool pool)
          Write the data specific to this attribute.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Attribute

protected Attribute(java.lang.String name)
Constructor for the Attribute object.

Parameters:
name - Name of this Attribute.
Method Detail

write

public final void write(ByteStream stream,
                        ConstantPool pool)
Writes this Attribute to the stream.

Parameters:
stream - Stream to write to.
pool - ConstantPool for this class.

writeData

protected abstract void writeData(ByteStream stream,
                                  ConstantPool pool)
Write the data specific to this attribute.

Parameters:
stream - Stream to write to.
pool - ConstantPool for this class.

getName

public final java.lang.String getName()
Returns the name of this Attribute.

Returns:
The name of this Attribute.


Copyright 2004-5, Mark Shannon