* @param verbose be verbose, e.g. print constant pool index
* @return String representation of byte codes
*/
public static final String codeToString(byte[] code, ConstantPool constant_pool, int index, int length, boolean verbose) {
StringBuffer buf = new StringBuffer(code.length * 20); // Should be sufficient
ByteSequence stream = new ByteSequence(code);
try {
for (int i = 0; i < index; i++) {
// Skip `index' lines of code
codeToString(stream, constant_pool, verbose);
}
for (int i = 0; stream.available() > 0; i++) {
if ((length < 0) || (i < length)) {
String indices = fillup(stream.getIndex() + ":", 6, true, ' ');
buf.append(indices + codeToString(stream, constant_pool, verbose) + '\n');
}
}
} catch (IOException e) {
System.out.println(buf.toString());