|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.ow2.asmdex.ApplicationReader
public class ApplicationReader
An Android Application parser for dex files to make an ApplicationVisitor
visit an existing application.
This class parses a byte array conforming to the APK/dex class file format and
calls the appropriate visit methods of a given class visitor for each class, field,
method and bytecode instruction encountered.
About Inner/Outer Classes :
| Field Summary | |
|---|---|
protected int |
api
API level |
byte[] |
byteCode
The bytecode to be parsed. |
static boolean |
DEBUG_DISPLAY_STRUCTURES
If true, displays the structures of the Decoded Application. |
static int |
SKIP_CODE
Flag to skip method code. |
static int |
SKIP_DEBUG
Flag to skip the debug information in the class. |
| Constructor Summary | |
|---|---|
ApplicationReader(int api,
byte[] byteCode)
Constructs a new ApplicationReader object. |
|
ApplicationReader(int api,
byte[] byteCode,
int startOffset,
int length)
Constructs a new ApplicationReader object. |
|
ApplicationReader(int api,
java.io.File file)
Constructs a new ApplicationReader object. |
|
ApplicationReader(int api,
java.io.InputStream inputStream)
Constructs a new ApplicationReader object. |
|
ApplicationReader(int api,
java.lang.String fileName)
Constructs a new ApplicationReader object. |
|
| Method Summary | |
|---|---|
void |
accept(ApplicationVisitor applicationVisitor,
int flags)
Makes the given visitor visit the Dex Application of this ApplicationReader. |
void |
accept(ApplicationVisitor applicationVisitor,
java.lang.String[] classesToVisit,
int flags)
Makes the given visitor visit the Dex Application of this ApplicationReader. |
void |
accept(ApplicationVisitor applicationVisitor,
java.lang.String[] classesToVisit,
java.lang.Object attrs,
int flags)
Makes the given visitor visit the Java class of this ClassVisitor. |
void |
copyPool(ApplicationWriter applicationWriter)
Copies the constant pool data into the given ApplicationWriter. |
IDalvikValueReader |
getDexFile()
Returns the Dex file. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public final byte[] byteCode
public static final boolean DEBUG_DISPLAY_STRUCTURES
public static final int SKIP_CODE
CODE
attribute won't be visited. This can be used, for example, to retrieve
annotations for methods and method parameters.
public static final int SKIP_DEBUG
visitLocalVariable and
visitLineNumber methods will not be
called. However, note that in AsmDex, debug_info_items may still be
created as it contains the prologue and end_sequence. In order to completely
prevent the debug_info_items to be created, use the
ApplicationWriter.SKIP_DEBUG_INFO_ITEMS flag.
protected int api
| Constructor Detail |
|---|
public ApplicationReader(int api,
byte[] byteCode)
ApplicationReader object.
byteCode - the bytecode of the application to be read.
public ApplicationReader(int api,
byte[] byteCode,
int startOffset,
int length)
ApplicationReader object.
byteCode - the bytecode of the application to be read.startOffset - the start offset of the application data.length - the length of the application data.
public ApplicationReader(int api,
java.io.InputStream inputStream)
throws java.io.IOException
ApplicationReader object.
inputStream - an input stream from which to read the application.
java.io.IOException - if a problem occurs during reading.
public ApplicationReader(int api,
java.lang.String fileName)
throws java.io.IOException
ApplicationReader object.
fileName - name and path of the application (DEX) to be read.
java.io.IOException - if an exception occurs during reading.
public ApplicationReader(int api,
java.io.File file)
throws java.io.IOException
ApplicationReader object.
file - the dex file to be read.
java.io.IOException - if an exception occurs during reading.| Method Detail |
|---|
public IDalvikValueReader getDexFile()
public void accept(ApplicationVisitor applicationVisitor,
java.lang.String[] classesToVisit,
int flags)
ApplicationReader.
All the classes, or only several, can be visited.
This application is the one specified in the constructor (see
ApplicationReader).
applicationVisitor - the visitor that must visit this class.classesToVisit - the names of the classes to visit, or Null to visit
all the classes of the application.flags - option flags that can be used to modify the default behavior
of this class. See SKIP_DEBUG, SKIP_CODE.
public void accept(ApplicationVisitor applicationVisitor,
int flags)
ApplicationReader.
All the classes are visited.
This application is the one specified in the constructor (see
ApplicationReader).
applicationVisitor - the visitor that must visit this class.flags - option flags that can be used to modify the default behavior
of this class. See SKIP_DEBUG, SKIP_CODE.
public void accept(ApplicationVisitor applicationVisitor,
java.lang.String[] classesToVisit,
java.lang.Object attrs,
int flags)
ClassVisitor.
This class is the one specified in the constructor
applicationVisitor - the visitor that must visit this Application.classesToVisit - the names of the classes to visit, or null to visit
all the classes of the application.attrs - Attributes are NOT supported by AsmDex, ignored.
Use annotations instead.flags - option flags that can be used to modify the default behavior
of this class. See SKIP_DEBUG, SKIP_CODE.public void copyPool(ApplicationWriter applicationWriter)
ApplicationWriter. Should
be called before the accept(ApplicationVisitor,int) method.
However, contrary to ASM, only the Strings, Types, Fields and Methods indexes are actually copied,
because that's the only things the methods are referring to. Also note that the elements given to
the ApplicationWriter are stored as symbolic indexes. Indeed, more Fields, Strings, Types or
Methods could be added, thus making the references already used wrong.
applicationWriter - the ApplicationWriter to copy constant pool into.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||