org.objectweb.asm.util

Class PrintClassVisitor

Implemented Interfaces:
ClassVisitor
Known Direct Subclasses:
ASMifierClassVisitor, TraceClassVisitor

public abstract class PrintClassVisitor
extends Object
implements ClassVisitor

An abstract class visitor that prints the classes it visits.
Author:
Eric Bruneton, Eugene Kuleshov

Field Summary

protected StringBuffer
buf
A buffer that can be used to create strings.
protected PrintWriter
pw
The print writer to be used to print the class.
protected List
text
The text to be printed.

Constructor Summary

PrintClassVisitor(PrintWriter pw)
Constructs a new PrintClassVisitor object.

Method Summary

static Attribute[]
getDefaultAttributes()
void
visitEnd()

Field Details

buf

protected final StringBuffer buf
A buffer that can be used to create strings.

pw

protected final PrintWriter pw
The print writer to be used to print the class.

text

protected final List text
The text to be printed. Since the code of methods is not necessarily visited in sequential order, one method after the other, but can be interlaced (some instructions from method one, then some instructions from method two, then some instructions from method one again...), it is not possible to print the visited instructions directly to a sequential stream. A class is therefore printed in a two steps process: a string tree is constructed during the visit, and printed to a sequential stream at the end of the visit. This string tree is stored in this field, as a string list that can contain other string lists, which can themselves contain other string lists, and so on.

Constructor Details

PrintClassVisitor

protected PrintClassVisitor(PrintWriter pw)
Parameters:
pw - the print writer to be used to print the class.

Method Details

getDefaultAttributes

public static Attribute[] getDefaultAttributes()

visitEnd

public void visitEnd()
Specified by:
visitEnd in interface ClassVisitor