at.dms.classfile
Class GenericAttribute

java.lang.Object
  |
  +--at.dms.classfile.Attribute
        |
        +--at.dms.classfile.GenericAttribute

public class GenericAttribute
extends Attribute

This is an opaque attribute that lets you add an uninterpreted stream of bytes into an attribute in a class file. This can be used (for instance) to embed versioning or signatures into the class file or method.


Fields inherited from class at.dms.classfile.Attribute
EMPTY
 
Constructor Summary
GenericAttribute(AsciiConstant name, java.io.DataInput in, ConstantPool cp)
          Make up a new attribute.
GenericAttribute(java.lang.String name, byte[] data)
          Make up a new attribute.
 
Method Summary
(package private)  java.lang.String getName()
          Returns the attribute's name.
(package private)  int getSize()
          Returns the space in bytes used by this attribute in the classfile.
(package private)  int getTag()
          Returns the attribute's tag.
(package private)  void resolveConstants(ConstantPool cp)
          Insert or check location of constant value on constant pool.
(package private)  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 at.dms.classfile.Attribute
read, readCodeInfoAttribute, readInterfaceOnly
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GenericAttribute

public GenericAttribute(java.lang.String name,
                        byte[] data)
Make up a new attribute.
Parameters:
name - Name to be associated with the attribute.
data - stream of bytes to be placed with the attribute.

GenericAttribute

public GenericAttribute(AsciiConstant name,
                        java.io.DataInput in,
                        ConstantPool cp)
                 throws java.io.IOException
Make up a new attribute.
Parameters:
name - the attribute's name.
in - the stream to read from.
cp - the constant pool.
Throws:
java.io.IOException - An io problem has occured.
Method Detail

getTag

int getTag()
Returns the attribute's tag.
Overrides:
getTag in class Attribute

getSize

int getSize()
Returns the space in bytes used by this attribute in the classfile.
Overrides:
getSize in class Attribute

getName

java.lang.String getName()
Returns the attribute's name.

resolveConstants

void resolveConstants(ConstantPool cp)
Insert or check location of constant value on constant pool.
Overrides:
resolveConstants in class Attribute
Parameters:
cp - the constant pool for this class.

write

void write(ConstantPool cp,
           java.io.DataOutput out)
     throws java.io.IOException
Write this class into the the file (out) getting data position from the constant pool.
Overrides:
write in class Attribute
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.