ConstantHTML( String dir, String class_name, String class_package, Method[] methods, ConstantPool constant_pool) throws IOException { this.class_name = class_name; this.class_package = class_package; this.constant_pool = constant_pool; this.methods = methods; constants = constant_pool.getConstantPool(); file = new PrintWriter(new FileOutputStream(dir + class_name + "_cp.html")); constant_ref = new String[constants.length]; constant_ref[0] = "<unknown>"; file.println("<HTML><BODY BGCOLOR=\"#C0C0C0\"><TABLE BORDER=0>"); // Loop through constants, constants[0] is reserved for (int i = 1; i < constants.length; i++) { if (i % 2 == 0) file.print("<TR BGCOLOR=\"#C0C0C0\"><TD>"); else file.print("<TR BGCOLOR=\"#A0A0A0\"><TD>"); if (constants[i] != null) writeConstant(i); file.print("</TD></TR>\n"); } file.println("</TABLE></BODY></HTML>"); file.close(); }
/** Initialize with given constant pool. */ public ConstantPoolGen(ConstantPool cp) { this(cp.getConstantPool()); }