|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjasmin.ClassFile
public class 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 |
addInner(short iacc,
String name,
String inner,
String outer)
|
void |
endHeader()
|
int |
errorCount()
Returns the number of warnings/errors encountered while parsing a file. |
String |
getClassName()
Returns the name of the class in the file (i.e. |
void |
readJasmin(Reader input,
String name,
boolean numberLines)
Parses a Jasmin file, converting it internally into a binary representation. |
void |
write(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, notifyAll, notify, toString, wait, wait, wait |
Constructor Detail |
---|
public ClassFile()
Method Detail |
---|
public void endHeader() throws jasError
jasError
public void addInner(short iacc, String name, String inner, String outer)
public void readJasmin(Reader input, String name, boolean numberLines) throws IOException, 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.
IOException
Exception
public int errorCount()
public String getClassName()
public void write(OutputStream outp) throws IOException, jasError
IOException
jasError
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |