Package proguard.dexfile.reader
Class DexFileReader
java.lang.Object
proguard.dexfile.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 intingore 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 intDo not throw an exception if debug info is not validstatic final intskip code info in dex file, this indicateSKIP_DEBUGstatic final intskip debug infos in dex file.static final intkeep clinit method whenSKIP_DEBUGstatic final intskip field constant in dex file. -
Constructor Summary
ConstructorsConstructorDescriptionDexFileReader(byte[] data) read dex from aByteBuffer.DexFileReader(ByteBuffer in, int position) read dex from aByteBuffer. -
Method Summary
Modifier and TypeMethodDescriptionvoidProvides the given consumer with all strings in the dex file.voidaccept(DexFileVisitor dv) equals toaccept(DexFileVisitor, int)with 0 as configvoidaccept(DexFileVisitor dv, int config) Makes the given visitor visit the dex file.voidaccept(DexFileVisitor dv, int classIdx, int config) Makes the given visitor visit the dex file.final intthe size of class in dex fileintignoreClass(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_EXCEPTIONingore 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_EXCEPTIONkeep clinit method whenSKIP_DEBUG- See Also:
-
SKIP_BROKEN_DEBUG_INFO
public static final int SKIP_BROKEN_DEBUG_INFODo not throw an exception if debug info is not valid- See Also:
-
-
Constructor Details
-
DexFileReader
read dex from aByteBuffer.- Parameters:
in-
-
DexFileReader
read dex from aByteBuffer.- Parameters:
in-position- start of the dexfile in the buffer
-
DexFileReader
public DexFileReader(byte[] data) - Parameters:
data- the byte array of dex
-
-
Method Details
-
niceExceptionMessage
-
readULeb128i
-
readLeb128i
-
getDexVersion
public int getDexVersion()- Specified by:
getDexVersionin interfaceBaseDexFileReader
-
accept
equals toaccept(DexFileVisitor, int)with 0 as config- Specified by:
acceptin interfaceBaseDexFileReader- Parameters:
dv-
-
getClassNames
- Specified by:
getClassNamesin interfaceBaseDexFileReader
-
accept
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
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
-
accept
Provides the given consumer with all strings in the dex file.- Specified by:
acceptin interfaceBaseDexFileReader
-
ignoreClass
-
getClassSize
public final int getClassSize()the size of class in dex file- Returns:
- class_defs_size
-