1 34 35 package org.logicalcobwebs.asm.util; 36 37 import org.logicalcobwebs.asm.ClassVisitor; 38 39 import java.io.PrintWriter ; 40 import java.util.ArrayList ; 41 import java.util.List ; 42 43 46 47 public abstract class PrintClassVisitor implements ClassVisitor { 48 49 61 62 protected final List text; 63 64 67 68 protected final StringBuffer buf; 69 70 73 74 protected final PrintWriter pw; 75 76 81 82 public PrintClassVisitor (final PrintWriter pw) { 83 this.text = new ArrayList (); 84 this.buf = new StringBuffer (); 85 this.pw = pw; 86 } 87 88 public void visitEnd () { 89 printList(text); 90 pw.flush(); 91 } 92 93 99 100 private void printList (final List l) { 101 for (int i = 0; i < l.size(); ++i) { 102 Object o = l.get(i); 103 if (o instanceof List ) { 104 printList((List )o); 105 } else { 106 pw.print(o.toString()); 107 } 108 } 109 } 110 } 111 | Popular Tags |