|
mjc | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.multijava.util.classfile.AttributeList
This class represents a list of attributes within a
ClassInfo structure (see JVM2, 4.7). This class also
includes static helper methods for parsing attributes from
.class files. This parsing is done using the
chain-of-responsibility pattern. See the Attribute class for a
sample member of the chain.
| Nested Class Summary | |
static class |
AttributeList.ParserIterator
This nested class implements a specialized iterator that returns successive parsers from the chain-of-responsibility and keeps clients from having to perform casts. |
| Field Summary | |
private Attribute[] |
attributes
|
private static java.util.LinkedList |
attrParsers
|
static Attribute[] |
EMPTY
|
| Constructor Summary | |
|
AttributeList()
Constructs an empty attribute list |
(package private) |
AttributeList(java.io.DataInput in,
ConstantPool cp,
boolean noCode)
Constructs an attribute list from a class file stream |
(package private) |
AttributeList(java.io.DataInput in,
ConstantPool cp,
Instruction[] insns)
Constructs an sub-attribute list of CodeInfo from a class file stream |
|
AttributeList(Attribute att1)
Constructs a one element attribute list |
|
AttributeList(Attribute att1,
Attribute att2)
Constructs a two elements attribute list |
|
AttributeList(Attribute att1,
Attribute att2,
Attribute att3)
Constructs a three elements attribute list |
|
AttributeList(Attribute att1,
Attribute att2,
Attribute att3,
Attribute att4)
Constructs a four elements attribute list |
| Method Summary | |
void |
add(Attribute attr)
Adds an attribute to the list of attributes |
static void |
addParser(AttributeParser prsr)
Adds the given AttributeParser to the head of the chain-of-responsibility. |
Attribute |
get(int tag)
Return the first attribute for this tag |
(package private) int |
getSize()
Returns the space in bytes used by this attribute in the classfile |
boolean |
isEmpty()
|
static AttributeList.ParserIterator |
parserIterator()
Returns a specialized iterator that returns successive parsers from the chain-of-responsibility. |
(package private) static Attribute |
read(java.io.DataInput in,
ConstantPool cp)
This method calls each member of the attribute parsing chain-of-responsibility in order to read the next attribute in the given input stream. |
(package private) static Attribute |
readCodeInfoAttribute(java.io.DataInput in,
ConstantPool cp,
Instruction[] insns)
This method calls each member of the attribute parsing chain-of-responsibility, in order, to read the next CodeInfo attribute in the given input stream. |
(package private) static Attribute |
readInterfaceOnly(java.io.DataInput in,
ConstantPool cp)
This method calls each member of the attribute parsing chain-of-responsibility in order to read the next attribute in the given input stream. |
(package private) boolean |
remove(int tag)
Removes an attribute from the list of attributes |
static void |
removeAllParsers()
Removes all parsers, including the default tail element BaseAttributeParser, from the
chain-of-responsibility. |
static void |
removeParser(AttributeParser prsr)
Removes the given parser from the chain-of-responsibility. |
static void |
resetParsers()
Resets the chain-of-responsibility to just include the default tail element BaseAttributeParser. |
(package private) void |
resolveConstants(ConstantPool cp)
Insert or check location of constant values in 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 java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
private Attribute[] attributes
private static final java.util.LinkedList attrParsers
public static final Attribute[] EMPTY
| Constructor Detail |
public AttributeList()
public AttributeList(Attribute att1)
public AttributeList(Attribute att1,
Attribute att2)
public AttributeList(Attribute att1,
Attribute att2,
Attribute att3)
public AttributeList(Attribute att1,
Attribute att2,
Attribute att3,
Attribute att4)
AttributeList(java.io.DataInput in,
ConstantPool cp,
boolean noCode)
throws java.io.IOException,
ClassFileFormatException
in - the stream to read fromcp - the constant poolnoCode - do not read code attribute
java.io.IOException - an io problem has occured
ClassFileFormatException - attempt to
write a bad classfile info
AttributeList(java.io.DataInput in,
ConstantPool cp,
Instruction[] insns)
throws java.io.IOException,
ClassFileFormatException
in - the stream to read fromcp - the constant poolinsns - (sparse) array of instructions
java.io.IOException - an io problem has occured
ClassFileFormatException - attempt to
write a bad classfile info| Method Detail |
static Attribute read(java.io.DataInput in,
ConstantPool cp)
throws java.io.IOException,
ClassFileFormatException
java.io.IOException
ClassFileFormatException
static Attribute readInterfaceOnly(java.io.DataInput in,
ConstantPool cp)
throws java.io.IOException,
ClassFileFormatException
java.io.IOException
ClassFileFormatException
static Attribute readCodeInfoAttribute(java.io.DataInput in,
ConstantPool cp,
Instruction[] insns)
throws java.io.IOException,
ClassFileFormatException
java.io.IOException
ClassFileFormatExceptionpublic static void addParser(AttributeParser prsr)
public static void removeParser(AttributeParser prsr)
public static void removeAllParsers()
BaseAttributeParser, from the
chain-of-responsibility.
public static void resetParsers()
BaseAttributeParser.
public static AttributeList.ParserIterator parserIterator()
public boolean isEmpty()
public final Attribute get(int tag)
tag - the tag that identifies the attributepublic final void add(Attribute attr)
attr - the attribute to add to the list, for convenience the
argument may be null in which case this does nothingfinal boolean remove(int tag)
tag - the tag that identifies the attribute
int getSize()
void resolveConstants(ConstantPool cp)
throws ClassFileFormatException
cp - the constant pool for this class
ClassFileFormatException
void write(ConstantPool cp,
java.io.DataOutput out)
throws java.io.IOException,
ClassFileFormatException
cp - the constant pool that contain all dataout - the file where to write this object info
java.io.IOException - an io problem has occured
ClassFileFormatException - attempt to
write a bad classfile info
|
mjc | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||