public class ClassWriter extends Object
ClassVisitor that generates classes in bytecode form. More precisely this visitor generates a byte array
conforming to the Java class file format. It can be used alone, to generate a Java class "from scratch", or with one
or more and adapter class visitor to generate a modified class from one or more existing Java classes.| 限定符和类型 | 字段和说明 |
|---|---|
static int |
COMPUTE_FRAMES
Flag to automatically compute the stack map frames of methods from scratch.
|
static int |
COMPUTE_MAXS
Flag to automatically compute the maximum stack size and the maximum number of local variables of methods.
|
| 构造器和说明 |
|---|
ClassWriter() |
| 限定符和类型 | 方法和说明 |
|---|---|
int |
newClass(String value) |
int |
newNameType(String name,
String desc) |
int |
newUTF8(String value) |
byte[] |
toByteArray()
Returns the bytecode of the class that was build with this class writer.
|
void |
visit(int version,
int access,
String name,
String superName,
String[] interfaces) |
void |
visitEnd() |
FieldVisitor |
visitField(int access,
String name,
String desc) |
MethodVisitor |
visitMethod(int access,
String name,
String desc,
String signature,
String[] exceptions) |
public static final int COMPUTE_MAXS
visitMaxs method of the
MethodVisitor returned by the visitMethod method will be ignored, and computed
automatically from the signature and the bytecode of each method.ClassWriter(int),
常量字段值public static final int COMPUTE_FRAMES
MethodVisitor#visitFrame method are ignored, and the stack map frames are recomputed from the
methods bytecode. The arguments of the visitMaxs method are also ignored and
recomputed from the bytecode. In other words, computeFrames implies computeMaxs.ClassWriter(int),
常量字段值public void visit(int version,
int access,
String name,
String superName,
String[] interfaces)
public FieldVisitor visitField(int access, String name, String desc)
public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions)
public void visitEnd()
public byte[] toByteArray()
public int newUTF8(String value)
public int newClass(String value)
Copyright © 2012-2013 Alibaba Group. All Rights Reserved.