public class AttributeInfo extends AbstractStructureWithAttributes
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
SYSTEM_PROPERTY_SKIP_ATTRIBUTES
Set this JVM System property to true to skip reading of all attributes.
|
attributesclassFile, debug, SYSTEM_PROPERTY_DEBUG| Modifier | Constructor and Description |
|---|---|
protected |
AttributeInfo()
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
static AttributeInfo |
createOrSkip(java.io.DataInput in,
ClassFile classFile)
Factory method for creating AttributeInfo structures.
|
int |
getAttributeLength()
Get the length of this attribute as a number of bytes.
|
int |
getAttributeNameIndex()
Get the constant pool index for the name of the attribute.
|
byte[] |
getInfo()
Get the raw bytes of the attribute.
|
java.lang.String |
getName()
Get the name of the attribute.
|
protected java.lang.String |
printAccessFlagsVerbose(int accessFlags)
Utility method for derived structures.
|
void |
read(java.io.DataInput in)
Read this structure from the given DataInput.
|
void |
setAttributeNameIndex(int attributeNameIndex)
Set the constant pool index for the name of the attribute.
|
void |
setInfo(byte[] info)
Set the raw bytes of the attribute.
|
void |
write(java.io.DataOutput out)
Write this structure to the given DataOutput.
|
findAttribute, getAttributes, getTotalAttributesLength, readAttributes, setAttributes, writeAttributesdebug, getClassFile, getDebug, getLength, printAccessFlags, printAccessFlagsVerbose, printBytes, setClassFile, setDebugpublic static final java.lang.String SYSTEM_PROPERTY_SKIP_ATTRIBUTES
public static AttributeInfo createOrSkip(java.io.DataInput in, ClassFile classFile) throws InvalidByteCodeException, java.io.IOException
An AttributeInfo of the appropriate subtype from the attributes package is created unless the type of the attribute is unknown in which case an instance of AttributeInfo is returned.
Attributes are skipped if the environment variable SYSTEM_PROPERTY_SKIP_ATTRIBUTES is set to true.
in - the DataInput from which to read the AttributeInfo structureclassFile - the parent class file of the structure to be createdInvalidByteCodeException - if the byte code is invalidjava.io.IOException - if an exception occurs with the DataInputpublic int getAttributeNameIndex()
public void setAttributeNameIndex(int attributeNameIndex)
attributeNameIndex - the new indexpublic byte[] getInfo()
Is non-null only if attribute is of unknown type.
public void setInfo(byte[] info)
Works only if attribute is an instance of AttributeInfo.
info - the new byte arraypublic java.lang.String getName()
throws InvalidByteCodeException
InvalidByteCodeException - if the byte code is invalidpublic void read(java.io.DataInput in)
throws InvalidByteCodeException,
java.io.IOException
AbstractStructureExcpects DataInput to be in JVM class file format and just before a structure of this kind. No look ahead parsing since the class file format is deterministic.
read in class AbstractStructurein - the DataInput from which to readInvalidByteCodeException - if the byte code is invalidjava.io.IOException - if an exception occurs with the DataInputpublic void write(java.io.DataOutput out)
throws InvalidByteCodeException,
java.io.IOException
AbstractStructureThe written bytes are in JVM class file format.
write in class AbstractStructureout - the DataOutput to which to writeInvalidByteCodeException - if the structure is internally inconsistentjava.io.IOException - if an exception occurs with the DataOutputpublic int getAttributeLength()
protected java.lang.String printAccessFlagsVerbose(int accessFlags)
AbstractStructureprintAccessFlagsVerbose in class AbstractStructureaccessFlags - the unsigned short value to print as a hex string