ClassAttributepublic abstract class ClassAttribute extends Object implements VMConstantsAn abstract base class for the attributes within a class file |
Fields Summary |
---|
private ConstUtf8 | attributeName |
Constructors Summary |
---|
ClassAttribute(ConstUtf8 theAttrName)Constructor
attributeName = theAttrName;
|
Methods Summary |
---|
public ConstUtf8 | attrName()Returns the name of the attribute
return attributeName;
| abstract void | print(java.io.PrintStream out, int indent)Print a description of the attribute to the print stream
| static com.sun.jdo.api.persistence.enhancer.classfile.ClassAttribute | read(java.io.DataInputStream data, ConstantPool pool)General attribute reader
ClassAttribute attr = null;
int attrNameIndex = data.readUnsignedShort();
ConstUtf8 attrName8 = (ConstUtf8) pool.constantAt(attrNameIndex);
String attrName = attrName8.asString();
int attrLength = data.readInt();
if (attrName.equals(CodeAttribute.expectedAttrName)) {
/* The old style code attribute reader uses more memory and
cpu when the instructions don't need to be examined than the
new deferred attribute reader. We may at some point decide that
we want to change the default based on the current situation
but for now we will just use the deferred reader in all cases. */
if (true) {
attr = CodeAttribute.read(attrName8, attrLength, data, pool);
} else {
attr = CodeAttribute.read(attrName8, data, pool);
}
}
else if (attrName.equals(SourceFileAttribute.expectedAttrName)) {
attr = SourceFileAttribute.read(attrName8, data, pool);
}
else if (attrName.equals(ConstantValueAttribute.expectedAttrName)) {
attr = ConstantValueAttribute.read(attrName8, data, pool);
}
else if (attrName.equals(ExceptionsAttribute.expectedAttrName)) {
attr = ExceptionsAttribute.read(attrName8, data, pool);
}
else if (attrName.equals(AnnotatedClassAttribute.expectedAttrName)) {
attr = AnnotatedClassAttribute.read(attrName8, data, pool);
}
else {
/* Unrecognized method attribute */
byte attrBytes[] = new byte[attrLength];
data.readFully(attrBytes);
attr = new GenericAttribute (attrName8, attrBytes);
}
return attr;
| static com.sun.jdo.api.persistence.enhancer.classfile.ClassAttribute | read(java.io.DataInputStream data, CodeEnv env)
ClassAttribute attr = null;
int attrNameIndex = data.readUnsignedShort();
ConstUtf8 attrName8 = (ConstUtf8) env.pool().constantAt(attrNameIndex);
String attrName = attrName8.asString();
int attrLength = data.readInt();
if (attrName.equals(LineNumberTableAttribute.expectedAttrName)) {
attr = LineNumberTableAttribute.read(attrName8, data, env);
}
else if (attrName.equals(LocalVariableTableAttribute.expectedAttrName)) {
attr = LocalVariableTableAttribute.read(attrName8, data, env);
}
else if (attrName.equals(AnnotatedMethodAttribute.expectedAttrName)) {
attr = AnnotatedMethodAttribute.read(attrName8, data, env);
}
//@olsen: fix 4467428, added support for synthetic code attribute
else if (attrName.equals(SyntheticAttribute.expectedAttrName)) {
attr = SyntheticAttribute.read(attrName8, data, env.pool());
}
else {
/* Unrecognized method attribute */
byte attrBytes[] = new byte[attrLength];
data.readFully(attrBytes);
attr = new GenericAttribute (attrName8, attrBytes);
}
return attr;
| abstract void | write(java.io.DataOutputStream out)Write the attribute to the output stream
|
|