|
ej-technologies | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.gjt.jclasslib.structures.AbstractStructure
org.gjt.jclasslib.structures.AbstractStructureWithAttributes
org.gjt.jclasslib.structures.AttributeInfo
Base class for all attribute structures in the attribute package.
Field Summary | |
static String |
SYSTEM_PROPERTY_SKIP_ATTRIBUTES
Set this JVM System property to true to skip reading of all attributes. |
Fields inherited from class org.gjt.jclasslib.structures.AbstractStructureWithAttributes |
attributes |
Fields inherited from class org.gjt.jclasslib.structures.AbstractStructure |
classFile, debug, SYSTEM_PROPERTY_DEBUG |
Constructor Summary | |
protected |
AttributeInfo()
Constructor. |
Method Summary | |
static AttributeInfo |
createOrSkip(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. |
String |
getName()
Get the name of the attribute. |
protected String |
printAccessFlagsVerbose(int accessFlags)
Utility method for derived structures. |
void |
read(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(DataOutput out)
Write this structure to the given DataOutput. |
Methods inherited from class org.gjt.jclasslib.structures.AbstractStructureWithAttributes |
findAttribute, getAttributes, getTotalAttributesLength, readAttributes, setAttributes, writeAttributes |
Methods inherited from class org.gjt.jclasslib.structures.AbstractStructure |
debug, getClassFile, getDebug, getLength, printAccessFlags, printAccessFlagsVerbose, printBytes, setClassFile, setDebug |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final String SYSTEM_PROPERTY_SKIP_ATTRIBUTES
Constructor Detail |
protected AttributeInfo()
Method Detail |
public static AttributeInfo createOrSkip(DataInput in, ClassFile classFile) throws InvalidByteCodeException, 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 created
InvalidByteCodeException
- if the byte code is invalid
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 String getName() throws InvalidByteCodeException
InvalidByteCodeException
- if the byte code is invalidpublic void read(DataInput in) throws InvalidByteCodeException, IOException
AbstractStructure
Excpects 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 AbstractStructure
in
- the DataInput from which to read
IOException
- if an exception occurs with the DataInput
InvalidByteCodeException
- if the byte code is invalidpublic void write(DataOutput out) throws InvalidByteCodeException, IOException
AbstractStructure
The written bytes are in JVM class file format.
write
in class AbstractStructure
out
- the DataOutput to which to write
IOException
- if an exception occurs with the DataOutput
InvalidByteCodeException
- if the structure is internally inconsistentpublic int getAttributeLength()
protected String printAccessFlagsVerbose(int accessFlags)
AbstractStructure
printAccessFlagsVerbose
in class AbstractStructure
accessFlags
- the unsigned short value to print as a hex string
|
ej-technologies | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |