|
ej-technologies | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--org.gjt.jclasslib.structures.AbstractStructure
Base class for all structures defined in the class file format.
Provides common services such as reading, writing and debugging.
| Field Summary | |
protected ClassFile |
classFile
Parent class file for this structure. |
protected boolean |
debug
Flag for debugging while reading and writing class files. |
static String |
SYSTEM_PROPERTY_DEBUG
Set this JVM System property to true to switch on debugging for reading and writing class files. |
| Constructor Summary | |
protected |
AbstractStructure()
Constructor. |
| Method Summary | |
protected void |
debug(String message)
Utility method for derived structures. |
ClassFile |
getClassFile()
Get parent class file. |
boolean |
getDebug()
Get the debug mode for this structure. |
protected int |
getLength(Object array)
Utility method for derived structures. |
protected String |
printAccessFlags(int accessFlags)
Utility method for derived structures. |
protected String |
printAccessFlagsVerbose(int accessFlags)
Utility method for derived structures. |
protected String |
printBytes(int bytes)
Utility method for derived structures. |
void |
read(DataInput in)
Read this structure from the given DataInput. |
void |
setClassFile(ClassFile classFile)
Set parent class file. |
void |
setDebug(boolean debug)
Set the debug mode for this structure. |
void |
write(DataOutput out)
Write this structure to the given DataOutput. |
| 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_DEBUG
protected ClassFile classFile
protected boolean debug
| Constructor Detail |
protected AbstractStructure()
| Method Detail |
public ClassFile getClassFile()
public void setClassFile(ClassFile classFile)
Has to be called at least once on a structure.
classFile - the new parent class file
public void read(DataInput in)
throws InvalidByteCodeException,
IOException
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.
in - the DataInput from which to read
InvalidByteCodeException - if the byte code is invalid
IOException - if an exception occurs with the DataInput
public void write(DataOutput out)
throws InvalidByteCodeException,
IOException
The written bytes are in JVM class file format.
out - the DataOutput to which to write
InvalidByteCodeException - if the structure is internally inconsistent
IOException - if an exception occurs with the DataOutputpublic boolean getDebug()
public void setDebug(boolean debug)
debug - the new debug modeprotected int getLength(Object array)
array - the array for which the length is requested
protected void debug(String message)
message - the debug messageprotected String printBytes(int bytes)
bytes - the int value to print as a hex string
protected String printAccessFlags(int accessFlags)
accessFlags - the unsigned short value to print as a hex string
protected String printAccessFlagsVerbose(int accessFlags)
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 | |||||||||