TechTrader Bytecode Toolkit

com.techtrader.modules.tools.bytecode.visitor
Class PrettyPrintVisitor

java.lang.Object
  |
  +--com.techtrader.modules.tools.bytecode.visitor.BCVisitor
        |
        +--com.techtrader.modules.tools.bytecode.visitor.PrettyPrintVisitor

public class PrettyPrintVisitor
extends BCVisitor
implements Constants

Visitor type that outputs a detailed, formatted document of the visited entity; similar to the javap -c command but more detailed.

Author:
Abe White

Fields inherited from interface com.techtrader.modules.tools.bytecode.Constants
AALOAD, AASTORE, ACCESS_ABSTRACT, ACCESS_FINAL, ACCESS_INTERFACE, ACCESS_NATIVE, ACCESS_PRIVATE, ACCESS_PROTECTED, ACCESS_PUBLIC, ACCESS_STATIC, ACCESS_STRICT, ACCESS_SUPER, ACCESS_SYNCHRONIZED, ACCESS_TRANSIENT, ACCESS_VOLATILE, ACONST_NULL, ALOAD, ALOAD_0, ALOAD_1, ALOAD_2, ALOAD_3, ANEWARRAY, ARETURN, ARRAY_BOOLEAN, ARRAY_BYTE, ARRAY_CHAR, ARRAY_DOUBLE, ARRAY_FLOAT, ARRAY_INT, ARRAY_LONG, ARRAY_SHORT, ARRAYLENGTH, ASTORE, ASTORE_0, ASTORE_1, ASTORE_2, ASTORE_3, ATHROW, ATTR_CODE, ATTR_CONST, ATTR_DEPRECATED, ATTR_EXCEPTIONS, ATTR_INNERCLASS, ATTR_LINENUMBERS, ATTR_LOCALS, ATTR_SOURCE, ATTR_SYNTHETIC, ATTR_UNKNOWN, BALOAD, BASTORE, BIPUSH, CALOAD, CASTORE, CHECKCAST, D2F, D2I, D2L, DADD, DALOAD, DASTORE, DCMPG, DCMPL, DCONST_0, DCONST_1, DDIV, DLOAD, DLOAD_0, DLOAD_1, DLOAD_2, DLOAD_3, DMUL, DNEG, DREM, DRETURN, DSTORE, DSTORE_0, DSTORE_1, DSTORE_2, DSTORE_3, DSUB, DUP, DUP_X1, DUP_X2, DUP2, DUP2_X1, DUP2_X2, F2D, F2I, F2L, FADD, FALOAD, FASTORE, FCMPG, FCMPL, FCONST_0, FCONST_1, FCONST_2, FDIV, FLOAD, FLOAD_0, FLOAD_1, FLOAD_2, FLOAD_3, FMUL, FNEG, FREM, FRETURN, FSTORE, FSTORE_0, FSTORE_1, FSTORE_2, FSTORE_3, FSUB, GETFIELD, GETSTATIC, GOTO, GOTO_W, I2B, I2C, I2D, I2F, I2L, I2S, IADD, IALOAD, IAND, IASTORE, ICONST_0, ICONST_1, ICONST_2, ICONST_3, ICONST_4, ICONST_5, ICONST_M1, IDIV, IF_ACMPEQ, IF_ACMPNE, IF_EQ, IF_GE, IF_GT, IF_ICMPEQ, IF_ICMPGE, IF_ICMPGT, IF_ICMPLE, IF_ICMPLT, IF_ICMPNE, IF_LE, IF_LT, IF_NE, IF_NONNULL, IF_NULL, IINC, ILOAD, ILOAD_0, ILOAD_1, ILOAD_2, ILOAD_3, IMUL, INEG, INSTANCEOF, INVOKEINTERFACE, INVOKESPECIAL, INVOKESTATIC, INVOKEVIRTUAL, IOR, IREM, IRETURN, ISHL, ISHR, ISTORE, ISTORE_0, ISTORE_1, ISTORE_2, ISTORE_3, ISUB, IUSHR, IXOR, JSR, JSR_W, L2D, L2F, L2I, LADD, LALOAD, LAND, LASTORE, LCMP, LCONST_0, LCONST_1, LDC, LDC_W, LDC2_W, LDIV, LLOAD, LLOAD_0, LLOAD_1, LLOAD_2, LLOAD_3, LMUL, LNEG, LOOKUPSWITCH, LOR, LREM, LRETURN, LSHL, LSHR, LSTORE, LSTORE_0, LSTORE_1, LSTORE_2, LSTORE_3, LSUB, LUSHR, LXOR, MATH_ADD, MATH_AND, MATH_DIV, MATH_MUL, MATH_NEG, MATH_OR, MATH_REM, MATH_SHL, MATH_SHR, MATH_SUB, MATH_USHR, MATH_XOR, MONITORENTER, MONITOREXIT, MULTIANEWARRAY, NEW, NEWARRAY, NOP, OPCODE_NAMES, POP, POP2, PUTFIELD, PUTSTATIC, RET, RETURN, SALOAD, SASTORE, SIPUSH, SWAP, TABLESWITCH, VALID_MAGIC, WIDE
 
Constructor Summary
PrettyPrintVisitor()
          Constructor; all pritning will go to stdout.
PrettyPrintVisitor(PrintWriter out)
          Constructor.
 
Method Summary
 void enterAttribute(Attribute obj)
           
 void enterBCClass(BCClass obj)
           
 void enterBCField(BCField obj)
           
 void enterBCMethod(BCMethod obj)
           
 void enterClassEntry(ClassEntry obj)
           
 void enterClassInstruction(ClassInstruction obj)
           
 void enterCode(Code obj)
           
 void enterConstantInstruction(ConstantInstruction obj)
           
 void enterConstantPool(ConstantPool obj)
           
 void enterConstantValueAttribute(ConstantValueAttribute obj)
           
 void enterDoubleEntry(DoubleEntry obj)
           
 void enterEntry(Entry obj)
           
 void enterExceptionHandler(ExceptionHandler obj)
           
 void enterExceptionsAttribute(ExceptionsAttribute obj)
           
 void enterFieldEntry(FieldEntry obj)
           
 void enterFloatEntry(FloatEntry obj)
           
 void enterGetFieldInstruction(GetFieldInstruction obj)
           
 void enterIIncInstruction(IIncInstruction obj)
           
 void enterInnerClass(InnerClass obj)
           
 void enterInstruction(Instruction obj)
           
 void enterIntEntry(IntEntry obj)
           
 void enterInterfaceMethodEntry(InterfaceMethodEntry obj)
           
 void enterJumpInstruction(JumpInstruction obj)
           
 void enterLineNumber(LineNumber obj)
           
 void enterLoadInstruction(LoadInstruction obj)
           
 void enterLocalVariable(LocalVariable obj)
           
 void enterLongEntry(LongEntry obj)
           
 void enterLookupSwitchInstruction(LookupSwitchInstruction obj)
           
 void enterMethodEntry(MethodEntry obj)
           
 void enterMethodInstruction(MethodInstruction obj)
           
 void enterMultiANewArrayInstruction(MultiANewArrayInstruction obj)
           
 void enterNameAndTypeEntry(NameAndTypeEntry obj)
           
 void enterNewArrayInstruction(NewArrayInstruction obj)
           
 void enterPutFieldInstruction(PutFieldInstruction obj)
           
 void enterRetInstruction(RetInstruction obj)
           
 void enterSourceFileAttribute(SourceFileAttribute obj)
           
 void enterStoreInstruction(StoreInstruction obj)
           
 void enterStringEntry(StringEntry obj)
           
 void enterTableSwitchInstruction(TableSwitchInstruction obj)
           
 void enterUnknownAttribute(UnknownAttribute obj)
           
 void enterUTF8Entry(UTF8Entry obj)
           
 void enterWideInstruction(WideInstruction obj)
           
 void exitAttribute(Attribute obj)
           
 void exitBCClass(BCClass obj)
           
 void exitBCField(BCField obj)
           
 void exitBCMethod(BCMethod obj)
           
 void exitConstantPool(ConstantPool obj)
           
 void exitEntry(Entry obj)
           
 void exitExceptionHandler(ExceptionHandler obj)
           
 void exitInnerClass(InnerClass obj)
           
 void exitInstruction(Instruction obj)
           
 void exitLineNumber(LineNumber obj)
           
 void exitLocalVariable(LocalVariable obj)
           
static void main(String[] args)
          Invoke with the class or file names to pretty print; the functionality is similar to the javap -c command, but more detailed.
 void visit(VisitAcceptor entity)
          Visit the given entity.
 
Methods inherited from class com.techtrader.modules.tools.bytecode.visitor.BCVisitor
enterArrayLoadInstruction, enterArrayStoreInstruction, enterCmpInstruction, enterConvertInstruction, enterDeprecatedAttribute, enterInnerClassesAttribute, enterLineNumberTableAttribute, enterLocalVariableTableAttribute, enterMathInstruction, enterMonitorEnterInstruction, enterMonitorExitInstruction, enterPlaceHolderEntry, enterReturnInstruction, enterStackInstruction, enterSyntheticAttribute, exitArrayLoadInstruction, exitArrayStoreInstruction, exitClassEntry, exitClassInstruction, exitCmpInstruction, exitCode, exitConstantInstruction, exitConstantValueAttribute, exitConvertInstruction, exitDeprecatedAttribute, exitDoubleEntry, exitExceptionsAttribute, exitFieldEntry, exitFloatEntry, exitGetFieldInstruction, exitIIncInstruction, exitInnerClassesAttribute, exitIntEntry, exitInterfaceMethodEntry, exitJumpInstruction, exitLineNumberTableAttribute, exitLoadInstruction, exitLocalVariableTableAttribute, exitLongEntry, exitLookupSwitchInstruction, exitMathInstruction, exitMethodEntry, exitMethodInstruction, exitMonitorEnterInstruction, exitMonitorExitInstruction, exitMultiANewArrayInstruction, exitNameAndTypeEntry, exitNewArrayInstruction, exitPlaceHolderEntry, exitPutFieldInstruction, exitRetInstruction, exitReturnInstruction, exitSourceFileAttribute, exitStackInstruction, exitStoreInstruction, exitStringEntry, exitSyntheticAttribute, exitTableSwitchInstruction, exitUnknownAttribute, exitUTF8Entry, exitWideInstruction
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PrettyPrintVisitor

public PrettyPrintVisitor()
Constructor; all pritning will go to stdout.

PrettyPrintVisitor

public PrettyPrintVisitor(PrintWriter out)
Constructor.
Parameters:
out - the stream to print to
Method Detail

main

public static void main(String[] args)
                 throws ClassNotFoundException,
                        IOException
Invoke with the class or file names to pretty print; the functionality is similar to the javap -c command, but more detailed.

visit

public void visit(VisitAcceptor entity)
Description copied from class: BCVisitor
Visit the given entity.
Overrides:
visit in class BCVisitor

enterBCClass

public void enterBCClass(BCClass obj)
Overrides:
enterBCClass in class BCVisitor

exitBCClass

public void exitBCClass(BCClass obj)
Overrides:
exitBCClass in class BCVisitor

enterBCField

public void enterBCField(BCField obj)
Overrides:
enterBCField in class BCVisitor

exitBCField

public void exitBCField(BCField obj)
Overrides:
exitBCField in class BCVisitor

enterBCMethod

public void enterBCMethod(BCMethod obj)
Overrides:
enterBCMethod in class BCVisitor

exitBCMethod

public void exitBCMethod(BCMethod obj)
Overrides:
exitBCMethod in class BCVisitor

enterAttribute

public void enterAttribute(Attribute obj)
Overrides:
enterAttribute in class BCVisitor

exitAttribute

public void exitAttribute(Attribute obj)
Overrides:
exitAttribute in class BCVisitor

enterConstantValueAttribute

public void enterConstantValueAttribute(ConstantValueAttribute obj)
Overrides:
enterConstantValueAttribute in class BCVisitor

enterExceptionsAttribute

public void enterExceptionsAttribute(ExceptionsAttribute obj)
Overrides:
enterExceptionsAttribute in class BCVisitor

enterSourceFileAttribute

public void enterSourceFileAttribute(SourceFileAttribute obj)
Overrides:
enterSourceFileAttribute in class BCVisitor

enterUnknownAttribute

public void enterUnknownAttribute(UnknownAttribute obj)
Overrides:
enterUnknownAttribute in class BCVisitor

enterCode

public void enterCode(Code obj)
Overrides:
enterCode in class BCVisitor

enterExceptionHandler

public void enterExceptionHandler(ExceptionHandler obj)
Overrides:
enterExceptionHandler in class BCVisitor

exitExceptionHandler

public void exitExceptionHandler(ExceptionHandler obj)
Overrides:
exitExceptionHandler in class BCVisitor

enterInnerClass

public void enterInnerClass(InnerClass obj)
Overrides:
enterInnerClass in class BCVisitor

exitInnerClass

public void exitInnerClass(InnerClass obj)
Overrides:
exitInnerClass in class BCVisitor

enterLineNumber

public void enterLineNumber(LineNumber obj)
Overrides:
enterLineNumber in class BCVisitor

exitLineNumber

public void exitLineNumber(LineNumber obj)
Overrides:
exitLineNumber in class BCVisitor

enterLocalVariable

public void enterLocalVariable(LocalVariable obj)
Overrides:
enterLocalVariable in class BCVisitor

exitLocalVariable

public void exitLocalVariable(LocalVariable obj)
Overrides:
exitLocalVariable in class BCVisitor

enterInstruction

public void enterInstruction(Instruction obj)
Overrides:
enterInstruction in class BCVisitor

exitInstruction

public void exitInstruction(Instruction obj)
Overrides:
exitInstruction in class BCVisitor

enterClassInstruction

public void enterClassInstruction(ClassInstruction obj)
Overrides:
enterClassInstruction in class BCVisitor

enterConstantInstruction

public void enterConstantInstruction(ConstantInstruction obj)
Overrides:
enterConstantInstruction in class BCVisitor

enterGetFieldInstruction

public void enterGetFieldInstruction(GetFieldInstruction obj)
Overrides:
enterGetFieldInstruction in class BCVisitor

enterIIncInstruction

public void enterIIncInstruction(IIncInstruction obj)
Overrides:
enterIIncInstruction in class BCVisitor

enterJumpInstruction

public void enterJumpInstruction(JumpInstruction obj)
Overrides:
enterJumpInstruction in class BCVisitor

enterLoadInstruction

public void enterLoadInstruction(LoadInstruction obj)
Overrides:
enterLoadInstruction in class BCVisitor

enterLookupSwitchInstruction

public void enterLookupSwitchInstruction(LookupSwitchInstruction obj)
Overrides:
enterLookupSwitchInstruction in class BCVisitor

enterMethodInstruction

public void enterMethodInstruction(MethodInstruction obj)
Overrides:
enterMethodInstruction in class BCVisitor

enterMultiANewArrayInstruction

public void enterMultiANewArrayInstruction(MultiANewArrayInstruction obj)
Overrides:
enterMultiANewArrayInstruction in class BCVisitor

enterNewArrayInstruction

public void enterNewArrayInstruction(NewArrayInstruction obj)
Overrides:
enterNewArrayInstruction in class BCVisitor

enterPutFieldInstruction

public void enterPutFieldInstruction(PutFieldInstruction obj)
Overrides:
enterPutFieldInstruction in class BCVisitor

enterRetInstruction

public void enterRetInstruction(RetInstruction obj)
Overrides:
enterRetInstruction in class BCVisitor

enterStoreInstruction

public void enterStoreInstruction(StoreInstruction obj)
Overrides:
enterStoreInstruction in class BCVisitor

enterTableSwitchInstruction

public void enterTableSwitchInstruction(TableSwitchInstruction obj)
Overrides:
enterTableSwitchInstruction in class BCVisitor

enterWideInstruction

public void enterWideInstruction(WideInstruction obj)
Overrides:
enterWideInstruction in class BCVisitor

enterConstantPool

public void enterConstantPool(ConstantPool obj)
Overrides:
enterConstantPool in class BCVisitor

exitConstantPool

public void exitConstantPool(ConstantPool obj)
Overrides:
exitConstantPool in class BCVisitor

enterEntry

public void enterEntry(Entry obj)
Overrides:
enterEntry in class BCVisitor

exitEntry

public void exitEntry(Entry obj)
Overrides:
exitEntry in class BCVisitor

enterClassEntry

public void enterClassEntry(ClassEntry obj)
Overrides:
enterClassEntry in class BCVisitor

enterDoubleEntry

public void enterDoubleEntry(DoubleEntry obj)
Overrides:
enterDoubleEntry in class BCVisitor

enterFieldEntry

public void enterFieldEntry(FieldEntry obj)
Overrides:
enterFieldEntry in class BCVisitor

enterFloatEntry

public void enterFloatEntry(FloatEntry obj)
Overrides:
enterFloatEntry in class BCVisitor

enterIntEntry

public void enterIntEntry(IntEntry obj)
Overrides:
enterIntEntry in class BCVisitor

enterInterfaceMethodEntry

public void enterInterfaceMethodEntry(InterfaceMethodEntry obj)
Overrides:
enterInterfaceMethodEntry in class BCVisitor

enterLongEntry

public void enterLongEntry(LongEntry obj)
Overrides:
enterLongEntry in class BCVisitor

enterMethodEntry

public void enterMethodEntry(MethodEntry obj)
Overrides:
enterMethodEntry in class BCVisitor

enterNameAndTypeEntry

public void enterNameAndTypeEntry(NameAndTypeEntry obj)
Overrides:
enterNameAndTypeEntry in class BCVisitor

enterStringEntry

public void enterStringEntry(StringEntry obj)
Overrides:
enterStringEntry in class BCVisitor

enterUTF8Entry

public void enterUTF8Entry(UTF8Entry obj)
Overrides:
enterUTF8Entry in class BCVisitor

TechTrader Bytecode Toolkit