All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class gnu.bytecode.Attribute

java.lang.Object
   |
   +----gnu.bytecode.Attribute

public abstract class Attribute
extends Object
Represents an Attribute of an AttrContainer.

Various sub-classses are used for standard attributes, or you can use MiscAttr for a generic attribute.

Author:
Per Bothner

Constructor Index

 o Attribute(String)
Create a new Attribute.

Method Index

 o assignConstants(AttrContainer, ClassType)
Add any needed constant pool entries for all attributes in a container.
 o assignConstants(ClassType)
Add any needed constant pool entries for this Attribute.
 o count(AttrContainer)
 o get(AttrContainer, String)
Find an Attribute by name, in an attribute cointainer.
 o getContainer()
Return the Attribute container that contains this Attribute.
 o getLength()
Return the length of the attribute in bytes.
 o getLengthAll(AttrContainer)
Return the length of all the attributes (with headers) in bytes.
 o getName()
 o getNameIndex()
 o getNext()
Get the next Attribute belonging to getContainer().
 o isSkipped()
Returns true if this attribute should be skipped on output.
 o print(ClassTypeWriter)
 o setContainer(AttrContainer)
 o setName(String)
 o setNameIndex(int)
 o setNext(Attribute)
Set the next Attribute in the chain belonging to getContainer().
 o setSkipped()
Cause this attributed to be skipped on output.
 o setSkipped(boolean)
Iff skip, cause this attributed to be skipped on output.
 o write(DataOutputStream)
Write out the contents of the Attribute.
 o writeAll(AttrContainer, DataOutputStream)

Constructors

 o Attribute
 public Attribute(String name)
Create a new Attribute.

Parameters:
name - - an interned String that names the Attribute.

Methods

 o getContainer
 public final AttrContainer getContainer()
Return the Attribute container that contains this Attribute.

 o setContainer
 public final void setContainer(AttrContainer container)
 o getNext
 public final Attribute getNext()
Get the next Attribute belonging to getContainer().

 o setNext
 public final void setNext(Attribute next)
Set the next Attribute in the chain belonging to getContainer().

 o isSkipped
 public final boolean isSkipped()
Returns true if this attribute should be skipped on output.

 o setSkipped
 public final void setSkipped(boolean skip)
Iff skip, cause this attributed to be skipped on output.

 o setSkipped
 public final void setSkipped()
Cause this attributed to be skipped on output.

 o getName
 public final String getName()
 o setName
 public final void setName(String name)
 o getNameIndex
 public final int getNameIndex()
 o setNameIndex
 public final void setNameIndex(int index)
 o get
 public static Attribute get(AttrContainer container,
                             String name)
Find an Attribute by name, in an attribute cointainer.

Parameters:
container - the attribute container to search
name - the (interned) name of the attribute we are seeking
Returns:
the matching Attribute, or null if the search failed.
 o assignConstants
 public void assignConstants(ClassType cl)
Add any needed constant pool entries for this Attribute. Overridden by sub-classes. Do any other cleanup needed before writing out a .class file.

 o assignConstants
 public static void assignConstants(AttrContainer container,
                                    ClassType cl)
Add any needed constant pool entries for all attributes in a container. Do any other cleanup needed before writing out a .class file.

 o getLength
 public abstract int getLength()
Return the length of the attribute in bytes. Does not include the 6-byte header (for the name_index and the length).

 o getLengthAll
 public static int getLengthAll(AttrContainer container)
Return the length of all the attributes (with headers) in bytes.

 o write
 public abstract void write(DataOutputStream dstr) throws IOException
Write out the contents of the Attribute. Does not write the 6-byte attribute header.

 o count
 public static int count(AttrContainer container)
 o writeAll
 public static void writeAll(AttrContainer container,
                             DataOutputStream dstr) throws IOException
 o print
 public void print(ClassTypeWriter dst)

All Packages  Class Hierarchy  This Package  Previous  Next  Index