public class DexFileReader extends java.lang.Object implements BaseDexFileReader
DexFileVisitor visitor = new xxxFileVisitor(); DexFileReader reader = new DexFileReader(dexFile); reader.accept(visitor);
Modifier and Type | Field and Description |
---|---|
static int |
IGNORE_READ_EXCEPTION
ingore read exception
|
static int |
KEEP_ALL_METHODS
read all methods, even if they are glitch
|
static int |
KEEP_CLINIT
keep clinit method when
SKIP_DEBUG |
static int |
SKIP_ANNOTATION
skip annotation info in dex file.
|
static int |
SKIP_BROKEN_DEBUG_INFO
Do not throw an exception if debug info is not valid
|
static int |
SKIP_CODE
skip code info in dex file, this indicate
SKIP_DEBUG |
static int |
SKIP_DEBUG
skip debug infos in dex file.
|
static int |
SKIP_EXCEPTION
keep clinit method when
SKIP_DEBUG |
static int |
SKIP_FIELD_CONSTANT
skip field constant in dex file.
|
Constructor and Description |
---|
DexFileReader(byte[] data) |
DexFileReader(java.nio.ByteBuffer in)
read dex from a
ByteBuffer . |
DexFileReader(java.nio.ByteBuffer in,
int position)
read dex from a
ByteBuffer . |
Modifier and Type | Method and Description |
---|---|
void |
accept(java.util.function.Consumer<java.lang.String> stringConsumer)
Provides the given consumer with all strings in the dex file.
|
void |
accept(DexFileVisitor dv)
equals to
accept(DexFileVisitor, int) with 0 as config |
void |
accept(DexFileVisitor dv,
int config)
Makes the given visitor visit the dex file.
|
void |
accept(DexFileVisitor dv,
int classIdx,
int config)
Makes the given visitor visit the dex file.
|
java.util.List<java.lang.String> |
getClassNames() |
int |
getClassSize()
the size of class in dex file
|
int |
getDexVersion() |
java.lang.Boolean |
ignoreClass(java.lang.String className) |
static void |
niceExceptionMessage(java.lang.Throwable t,
int deep) |
static int |
readLeb128i(java.nio.ByteBuffer in) |
static int |
readULeb128i(java.nio.ByteBuffer in) |
public static final int SKIP_DEBUG
public static final int SKIP_CODE
SKIP_DEBUG
public static final int SKIP_ANNOTATION
public static final int SKIP_FIELD_CONSTANT
public static final int IGNORE_READ_EXCEPTION
public static final int KEEP_ALL_METHODS
public static final int KEEP_CLINIT
SKIP_DEBUG
public static final int SKIP_EXCEPTION
SKIP_DEBUG
public static final int SKIP_BROKEN_DEBUG_INFO
public DexFileReader(java.nio.ByteBuffer in)
ByteBuffer
.in
- public DexFileReader(java.nio.ByteBuffer in, int position)
ByteBuffer
.in
- position
- start of the dexfile in the bufferpublic DexFileReader(byte[] data)
data
- the byte array of dexpublic static void niceExceptionMessage(java.lang.Throwable t, int deep)
public static int readULeb128i(java.nio.ByteBuffer in)
public static int readLeb128i(java.nio.ByteBuffer in)
public int getDexVersion()
getDexVersion
in interface BaseDexFileReader
public void accept(DexFileVisitor dv)
accept(DexFileVisitor, int)
with 0 as configaccept
in interface BaseDexFileReader
dv
- public java.util.List<java.lang.String> getClassNames()
getClassNames
in interface BaseDexFileReader
public void accept(DexFileVisitor dv, int config)
accept
in interface BaseDexFileReader
dv
- visitorconfig
- config flags, SKIP_CODE
, SKIP_DEBUG
, SKIP_ANNOTATION
,
SKIP_FIELD_CONSTANT
public void accept(DexFileVisitor dv, int classIdx, int config)
DexFileVisitor.visitEnd()
is not
calledaccept
in interface BaseDexFileReader
dv
- visitorclassIdx
- index of class_defconfig
- config flags, SKIP_CODE
, SKIP_DEBUG
, SKIP_ANNOTATION
,
SKIP_FIELD_CONSTANT
public void accept(java.util.function.Consumer<java.lang.String> stringConsumer)
accept
in interface BaseDexFileReader
public java.lang.Boolean ignoreClass(java.lang.String className)
public final int getClassSize()