at.dms.classfile
Class Attribute

java.lang.Object
  |
  +--at.dms.classfile.Attribute
Direct Known Subclasses:
CodeInfo, ConstantValueAttribute, DeprecatedAttribute, ExceptionsAttribute, GenericAttribute, InnerClassTable, LineNumberTable, LocalVariableTable, SourceFileAttribute, SyntheticAttribute

public abstract class Attribute
extends java.lang.Object

This is the root class of every attribute


Field Summary
static Attribute[] EMPTY
           
 
Constructor Summary
Attribute()
           
 
Method Summary
(package private) abstract  int getSize()
          Returns the space in bytes used by this attribute in the classfile
(package private) abstract  int getTag()
          Returns the attribute's tag
static Attribute read(java.io.DataInput in, ConstantPool cp)
          Constructs an attribute from a class file stream
static Attribute readCodeInfoAttribute(java.io.DataInput in, ConstantPool cp, Instruction[] insns)
          Constructs an sub-attribute of CodeInfo from a class file stream
static Attribute readInterfaceOnly(java.io.DataInput in, ConstantPool cp)
          Constructs an attribute from a class file stream
(package private) abstract  void resolveConstants(ConstantPool cp)
          Insert or check location of constant value on constant pool
(package private) abstract  void write(ConstantPool cp, java.io.DataOutput out)
          Write this class into the the file (out) getting data position from the constant pool
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EMPTY

public static final Attribute[] EMPTY
Constructor Detail

Attribute

public Attribute()
Method Detail

read

public static Attribute read(java.io.DataInput in,
                             ConstantPool cp)
                      throws java.io.IOException,
                             ClassFileFormatException
Constructs an attribute from a class file stream
Parameters:
in - the stream to read from
cp - the constant pool
Throws:
java.io.IOException - an io problem has occured
ClassFileFormatException - attempt to write a bad classfile info

readInterfaceOnly

public static Attribute readInterfaceOnly(java.io.DataInput in,
                                          ConstantPool cp)
                                   throws java.io.IOException,
                                          ClassFileFormatException
Constructs an attribute from a class file stream
Parameters:
in - the stream to read from
cp - the constant pool
Throws:
java.io.IOException - an io problem has occured
ClassFileFormatException - attempt to write a bad classfile info

readCodeInfoAttribute

public static Attribute readCodeInfoAttribute(java.io.DataInput in,
                                              ConstantPool cp,
                                              Instruction[] insns)
                                       throws java.io.IOException,
                                              ClassFileFormatException
Constructs an sub-attribute of CodeInfo from a class file stream
Parameters:
in - the stream to read from
cp - the constant pool
insns - (sparse) array of instructions
Throws:
java.io.IOException - an io problem has occured
ClassFileFormatException - attempt to write a bad classfile info

getTag

abstract int getTag()
Returns the attribute's tag

getSize

abstract int getSize()
Returns the space in bytes used by this attribute in the classfile

resolveConstants

abstract void resolveConstants(ConstantPool cp)
                        throws ClassFileFormatException
Insert or check location of constant value on constant pool
Parameters:
cp - the constant pool for this class

write

abstract void write(ConstantPool cp,
                    java.io.DataOutput out)
             throws java.io.IOException,
                    ClassFileFormatException
Write this class into the the file (out) getting data position from the constant pool
Parameters:
cp - the constant pool that contain all data
out - the file where to write this object info
Throws:
java.io.IOException - an io problem has occured
ClassFileFormatException - attempt to write a bad classfile info