CSG Bytecode Package
This is a package for reading and writing Java .class files, such as for
building a compiler or disassembler. It includes a disassembler as well. The
license is BSD/Apache 2.0.
There are many bytecode packages available these days, including BCEL from
Apache, ASM, GNU Bytecode, and many others. What CSG Bytecode offers is
performance and convenience.
Regarding performance, CSG Bytecode has been engineered to create as few
objects as possible. The constant pool implementation absolutely rocks, although
a lot of credit for that is due to Per Bothner and his GNU bytecode package which
I re-implemented. Extensive use of linked-lists is used internally, although its
built-in and doesn't rely on java.util.Collections at all. When generating
bytecode all instructions are simply integer constants and are appended to a byte
buffer, rather than using an object instance for each instruction (like BCEL).
Regarding convenience, I worked hard to experiment with different API formats
that would yield readable source code. I've worked with most of the other bytecode
libraries and also experimented with several formats of my own, and I believe after
writing several thousand lines of code using this one that its pretty darn good.
View the Javadocs online here.