|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--jasmin.ClassFile
A ClassFile object is used to represent the binary data that makes up a Java class file - it also serves as the public API to the Jasmin assembler, though users should beware: the API is likely to change in future versions (though its such a small API at the moment that changes are likely to have only a small impact).
To assemble a file, you first construct a jasmin.ClassFile object, then call readJasmin() to read in the contents of a Jasmin assembly file, then call write() to write out the binary representation of the class file.
There are a few other utility methods as well. See Main.java for an example which uses all of the public methods provided in ClassFile.
Constructor Summary | |
ClassFile()
Makes a new ClassFile object, used to represent a Java class file. |
Method Summary | |
void |
addGenericAttrToClass(jas.GenericAttr g)
|
void |
addGenericAttrToField(java.lang.String name,
byte[] value)
|
void |
addGenericAttrToMethod(java.lang.String name,
byte[] value)
|
void |
addSootCodeAttr(java.lang.String name,
java.lang.String value)
|
int |
errorCount()
Returns the number of warnings/errors encountered while parsing a file. |
java.lang.String |
getClassName()
Returns the name of the class in the file (i.e. |
void |
readJasmin(java.io.InputStream input,
java.lang.String name,
boolean numberLines)
Parses a Jasmin file, converting it internally into a binary representation. |
void |
write(java.io.OutputStream outp)
Writes the binary data for the class represented by this ClassFile object to the specified output stream, using the Java Class File format. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Constructor Detail |
public ClassFile()
Method Detail |
public void addSootCodeAttr(java.lang.String name, java.lang.String value)
public void addGenericAttrToMethod(java.lang.String name, byte[] value)
public void addGenericAttrToField(java.lang.String name, byte[] value)
public void addGenericAttrToClass(jas.GenericAttr g)
public void readJasmin(java.io.InputStream input, java.lang.String name, boolean numberLines) throws java.io.IOException, java.lang.Exception
input
- is the stream containing the Jasmin assembly code for the
class.name
- is the name of the stream. This name will be
concatenated to error messages printed to System.err.numberLines
- true if you want Jasmin to generate line
numbers automatically, based on the assembly source, or
false if you are using the ".line" directive and don't
want Jasmin to help out.public int errorCount()
public java.lang.String getClassName()
public void write(java.io.OutputStream outp) throws java.io.IOException, jas.jasError
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |