Package com.googlecode.d2j.reader
Class DexFileReader
java.lang.Object
com.googlecode.d2j.reader.DexFileReader
- All Implemented Interfaces:
BaseDexFileReader
Open and read a dex file.this is the entrance of dex-reader. to read a dex/odex, use the following code:
DexFileVisitor visitor = new xxxFileVisitor(); DexFileReader reader = new DexFileReader(dexFile); reader.accept(visitor);
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intInstruct ASM to compute frames when generating class files, usingClassWriter.COMPUTE_FRAMES**EXPERIMENTAL CODE**static final intstatic final intignore read exceptionstatic final intread all methods, even if they are glitchstatic final intkeep clinit method whenSKIP_DEBUGstatic final intskip annotation info in dex file.static final intskip code info in dex file, this indicateSKIP_DEBUGstatic final intskip debug infos in dex file.static final intstatic final intskip field constant in dex file. -
Constructor Summary
ConstructorsConstructorDescriptionDexFileReader(byte[] data) DexFileReader(File file) read dex from aByteBuffer.DexFileReader(Path file) -
Method Summary
Modifier and TypeMethodDescriptionvoidaccept(com.googlecode.d2j.visitors.DexFileVisitor dv) equals toaccept(DexFileVisitor, int)with 0 as configvoidaccept(com.googlecode.d2j.visitors.DexFileVisitor dv, int config) Makes the given visitor visit the dex file.voidaccept(com.googlecode.d2j.visitors.DexFileVisitor dv, int classIdx, int config) Makes the given visitor visit the dex file.final intintignoreClass(String className) static voidniceExceptionMessage(Throwable t, int deep) static intstatic int
-
Field Details
-
SKIP_DEBUG
public static final int SKIP_DEBUGskip debug infos in dex file.- See Also:
-
SKIP_CODE
public static final int SKIP_CODEskip code info in dex file, this indicateSKIP_DEBUG- See Also:
-
SKIP_ANNOTATION
public static final int SKIP_ANNOTATIONskip annotation info in dex file.- See Also:
-
SKIP_FIELD_CONSTANT
public static final int SKIP_FIELD_CONSTANTskip field constant in dex file.- See Also:
-
IGNORE_READ_EXCEPTION
public static final int IGNORE_READ_EXCEPTIONignore read exception- See Also:
-
KEEP_ALL_METHODS
public static final int KEEP_ALL_METHODSread all methods, even if they are glitch- See Also:
-
KEEP_CLINIT
public static final int KEEP_CLINITkeep clinit method whenSKIP_DEBUG- See Also:
-
SKIP_EXCEPTION
public static final int SKIP_EXCEPTION- See Also:
-
DONT_SANITIZE_NAMES
public static final int DONT_SANITIZE_NAMES- See Also:
-
COMPUTE_FRAMES
public static final int COMPUTE_FRAMESInstruct ASM to compute frames when generating class files, usingClassWriter.COMPUTE_FRAMES**EXPERIMENTAL CODE**- See Also:
-
-
Constructor Details
-
DexFileReader
read dex from aByteBuffer. -
DexFileReader
public DexFileReader(byte[] data) - Parameters:
data- the byte array of dex
-
DexFileReader
- Parameters:
file- the dex file- Throws:
IOException
-
DexFileReader
- Throws:
IOException
-
DexFileReader
- Throws:
IOException
-
-
Method Details
-
niceExceptionMessage
-
readULeb128i
-
readLeb128i
-
getDexVersion
public int getDexVersion()- Specified by:
getDexVersionin interfaceBaseDexFileReader
-
accept
public void accept(com.googlecode.d2j.visitors.DexFileVisitor dv) equals toaccept(DexFileVisitor, int)with 0 as config- Specified by:
acceptin interfaceBaseDexFileReader
-
getClassNames
- Specified by:
getClassNamesin interfaceBaseDexFileReader
-
accept
public void accept(com.googlecode.d2j.visitors.DexFileVisitor dv, int config) Makes the given visitor visit the dex file.- Specified by:
acceptin interfaceBaseDexFileReader- Parameters:
dv- visitorconfig- config flags,SKIP_CODE,SKIP_DEBUG,SKIP_ANNOTATION,SKIP_FIELD_CONSTANT
-
accept
public void accept(com.googlecode.d2j.visitors.DexFileVisitor dv, int classIdx, int config) Makes the given visitor visit the dex file. Notice theDexFileVisitor.visitEnd()is not called- Specified by:
acceptin interfaceBaseDexFileReader- Parameters:
dv- visitorclassIdx- index of class_defconfig- config flags,SKIP_CODE,SKIP_DEBUG,SKIP_ANNOTATION,SKIP_FIELD_CONSTANT
-
ignoreClass
-
getClassSize
public final int getClassSize()
-