JML

org.multijava.util.classfile
Class GenericAttribute

java.lang.Object
  extended byorg.multijava.util.classfile.Attribute
      extended byorg.multijava.util.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.


Field Summary
private  byte[] data
           
private  AsciiConstant name
           
 
Constructor Summary
GenericAttribute(String name, byte[] data)
          Make up a new attribute
GenericAttribute(AsciiConstant name, DataInput in, ConstantPool cp)
          Make up a new attribute
 
Method Summary
(package private)  String getName()
          Returns the attribute's name
protected  int getSize()
          Returns the space in bytes used by this attribute in the classfile
protected  int getTag()
          Returns the attribute's tag
protected  void resolveConstants(ConstantPool cp)
          Insert or check location of constant value on constant pool
protected  void write(ConstantPool cp, 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

name

private AsciiConstant name

data

private byte[] data
Constructor Detail

GenericAttribute

public GenericAttribute(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,
                        DataInput in,
                        ConstantPool cp)
                 throws IOException
Make up a new attribute

Parameters:
name - the attribute's name
in - the stream to read from
cp - the constant pool
Throws:
IOException - an io problem has occured
Method Detail

getTag

protected int getTag()
Returns the attribute's tag


getSize

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


getName

String getName()
Returns the attribute's name


resolveConstants

protected void resolveConstants(ConstantPool cp)
Insert or check location of constant value on constant pool

Parameters:
cp - the constant pool for this class

write

protected void write(ConstantPool cp,
                     DataOutput out)
              throws IOException
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:
IOException - an io problem has occured

JML

JML is Copyright (C) 1998-2002 by Iowa State University and is distributed under the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This release depends on code from the MultiJava project and is based in part on the Kopi project Copyright (C) 1990-99 DMS Decision Management Systems Ges.m.b.H.