|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.ow2.asmdex.ApplicationVisitor
org.ow2.asmdex.ApplicationWriter
public class ApplicationWriter
A ApplicationVisitor that generates an Android dex file in
bytecode form. More precisely this visitor generates a byte array conforming
to the dex file format. It can be used alone, to generate Android classes
"from scratch", or with one or more ApplicationReader
and adapter Application visitor to generate a modified class from one or more existing
Java applications.
KNOWN ISSUES
| Field Summary | |
|---|---|
static boolean |
DISPLAY_WRITER_INFORMATION
Indicates if the writer information must be displayed. |
static boolean |
SKIP_DEBUG_INFO_ITEMS
Indicates if the writer must encode the Debug information that it is given. |
| Fields inherited from class org.ow2.asmdex.ApplicationVisitor |
|---|
api, av |
| Constructor Summary | |
|---|---|
ApplicationWriter()
Constructs an new ClassWriter. |
|
ApplicationWriter(ApplicationReader applicationReader)
Constructs a new ClassWriter object and enables optimizations for
"mostly add" bytecode transformations. |
|
| Method Summary | |
|---|---|
void |
addFieldFromApplicationReader(java.lang.String className,
java.lang.String type,
java.lang.String fieldName)
When the optimization about the ApplicationReader/ApplicationWriter is enabled, the ApplicationReader will want to register Fields into the Constant Pool of the Writer. |
void |
addMethodFromApplicationReader(java.lang.String className,
java.lang.String prototype,
java.lang.String methodName)
When the optimization about the ApplicationReader/ApplicationWriter is enabled, the ApplicationReader will want to register Methods into the Constant Pool of the Writer. |
void |
addStringFromApplicationReader(java.lang.String string)
When the optimization about the ApplicationReader/ApplicationWriter is enabled, the ApplicationReader will want to register Strings into the Constant Pool of the Writer. |
void |
addTypeNameFromApplicationReader(java.lang.String type)
When the optimization about the ApplicationReader/ApplicationWriter is enabled, the ApplicationReader will want to register Types into the Constant Pool of the Writer. |
ApplicationReader |
getApplicationReader()
Returns the ApplicationReader that may be linked to this ApplicationWriter. |
ConstantPool |
getConstantPool()
Gets the Constant Pool. |
byte[] |
toByteArray()
Returns the bytecode of the class that was built with this application writer. |
void |
visit()
Visits the header of the application. |
ClassVisitor |
visitClass(int access,
java.lang.String name,
java.lang.String[] signature,
java.lang.String superName,
java.lang.String[] interfaces)
Visits a class of the application. |
void |
visitEnd()
Visits the end of the application. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final boolean DISPLAY_WRITER_INFORMATION
public static final boolean SKIP_DEBUG_INFO_ITEMS
visitLocalVariable and
visitLineNumber, but has no power over the
creation of the debug_info_items.
| Constructor Detail |
|---|
public ApplicationWriter()
ClassWriter.
public ApplicationWriter(ApplicationReader applicationReader)
ClassWriter object and enables optimizations for
"mostly add" bytecode transformations. These optimizations are the
following:
ApplicationReader receives MethodVisitor objects
that come from a ApplicationWriter (and not from any other ApplicationVisitor instance).
applicationReader - the ApplicationReader used to read the original
application. It will be used to copy the entire constant pool from the
original application and also to copy other fragments of original
bytecode where applicable.| Method Detail |
|---|
public void visit()
ApplicationVisitor
visit in class ApplicationVisitor
public ClassVisitor visitClass(int access,
java.lang.String name,
java.lang.String[] signature,
java.lang.String superName,
java.lang.String[] interfaces)
ApplicationVisitorClassVisitor instance (or null) each time it is
called, i.e., it should not return a previously returned visitor.
visitClass in class ApplicationVisitoraccess - the access flags of the class (see Opcodes).name - the internal name of the class.signature - the signature of this class. May be null if
the class is not a generic one, and does not extend or implement
generic classes or interfaces.superName - the internal of name of the super class. For interfaces,
the super class is Object. May be null, but
only for the Object class.interfaces - the internal names of the class's interfaces. May be
null.
public void visitEnd()
ApplicationVisitor
visitEnd in class ApplicationVisitorpublic byte[] toByteArray()
public ConstantPool getConstantPool()
public ApplicationReader getApplicationReader()
public void addStringFromApplicationReader(java.lang.String string)
string - the String to add to the Constant Pool.public void addTypeNameFromApplicationReader(java.lang.String type)
type - the Type to add to the Constant Pool.
public void addFieldFromApplicationReader(java.lang.String className,
java.lang.String type,
java.lang.String fieldName)
className - the Class owner name.type - the type of the Field.fieldName - the name of the Field.
public void addMethodFromApplicationReader(java.lang.String className,
java.lang.String prototype,
java.lang.String methodName)
className - the Class owner name.prototype - the prototype of the method, in TypeDescriptor format.methodName - the name of the Method.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||