/** * @return String representation of code chunk. */ public final String toString(boolean verbose) { StringBuffer buf; buf = new StringBuffer("Code(max_stack = " + max_stack + ", max_locals = " + max_locals + ", code_length = " + code_length + ")\n" + Utility.codeToString(code, constant_pool, 0, -1, verbose)); if(exception_table_length > 0) { buf.append("\nException handler(s) = \n" + "From\tTo\tHandler\tType\n"); for(int i=0; i < exception_table_length; i++) buf.append(exception_table[i].toString(constant_pool, verbose) + "\n"); } if(attributes_count > 0) { buf.append("\nAttribute(s) = \n"); for(int i=0; i < attributes_count; i++) buf.append(attributes[i].toString() + "\n"); } return buf.toString(); }
protected String dumpAttributes(final Attribute[] as) { final StringBuilder result = new StringBuilder(); result.append("AttributeArray:["); for (int i = 0; i < as.length; i++) { final Attribute attr = as[i]; result.append(attr.toString()); if (i + 1 < as.length) { result.append(","); } } result.append("]"); return result.toString(); }
/** * Return string representation close to declaration format, * `public static final short MAX = 100', e.g.. * * @return String representation of field, including the signature. */ public final String toString() { String name, signature, access; // Short cuts to constant pool // Get names from constant pool access = Utility.accessToString(access_flags); access = access.equals("")? "" : (access + " "); signature = Utility.signatureToString(getSignature()); name = getName(); StringBuffer buf = new StringBuffer(access + signature + " " + name); ConstantValue cv = getConstantValue(); if(cv != null) buf.append(" = " + cv); for(int i=0; i < attributes_count; i++) { Attribute a = attributes[i]; if(!(a instanceof ConstantValue)) buf.append(" [" + a.toString() + "]"); } return buf.toString(); }
buf.append(" [" + a.toString() + "]");
file.print("<P>" + attribute.toString());