public final class DexFile
extends java.lang.Object
.dex (Dalvik EXecutable)
file, which itself consists of a set of Dalvik classes.| Constructor and Description |
|---|
DexFile(DexOptions dexOptions)
Constructs an instance.
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(ClassDefItem clazz)
Adds a class to this instance.
|
ClassDefsSection |
getClassDefs()
Gets the class definitions section.
|
ClassDefItem |
getClassOrNull(java.lang.String name)
Gets the class definition with the given name, if any.
|
DexOptions |
getDexOptions()
Gets the dex-creation options object.
|
FieldIdsSection |
getFieldIds()
Gets the field identifiers section.
|
int |
getFileSize()
Gets the total file size, if known.
|
MethodIdsSection |
getMethodIds()
Gets the method identifiers section.
|
Statistics |
getStatistics()
Generates and returns statistics for all the items in the file.
|
TypeIdsSection |
getTypeIds()
Gets the type identifiers section.
|
boolean |
isEmpty()
Returns true if this dex doesn't contain any class defs.
|
void |
setDumpWidth(int dumpWidth)
Sets the maximum width of the human-oriented dump of the instance.
|
byte[] |
toDex(java.io.Writer humanOut,
boolean verbose)
Returns the contents of this instance as a
.dex file,
in byte[] form. |
void |
writeTo(java.io.OutputStream out,
java.io.Writer humanOut,
boolean verbose)
Writes the contents of this instance as either a binary or a
human-readable form, or both.
|
public DexFile(DexOptions dexOptions)
public boolean isEmpty()
public DexOptions getDexOptions()
public void add(ClassDefItem clazz)
clazz - non-null; the class to addpublic ClassDefItem getClassOrNull(java.lang.String name)
name - non-null; the class name to look fornull-ok; the class with the given name, or null
if there is no such classpublic void writeTo(java.io.OutputStream out,
java.io.Writer humanOut,
boolean verbose)
throws java.io.IOException
out - null-ok; where to write tohumanOut - null-ok; where to write human-oriented output toverbose - whether to be verbose when writing human-oriented outputjava.io.IOExceptionpublic byte[] toDex(java.io.Writer humanOut,
boolean verbose)
throws java.io.IOException
.dex file,
in byte[] form.humanOut - null-ok; where to write human-oriented output toverbose - whether to be verbose when writing human-oriented outputnon-null; a .dex file for this instancejava.io.IOExceptionpublic void setDumpWidth(int dumpWidth)
dumpWidth - >= 40; the widthpublic int getFileSize()
This is package-scope in order to allow
the HeaderSection to set itself up properly.
>= 0; the total file sizejava.lang.RuntimeException - thrown if the file size is not yet knownpublic ClassDefsSection getClassDefs()
This is package-scope in order to allow
the various Item instances to add items to the
instance.
non-null; the class definitions sectionpublic TypeIdsSection getTypeIds()
This is public in order to allow
the various Item instances to add items to the
instance and help early counting of type ids.
non-null; the class identifiers sectionpublic FieldIdsSection getFieldIds()
This is public in order to allow
the various Item instances to add items to the
instance and help early counting of field ids.
non-null; the field identifiers sectionpublic MethodIdsSection getMethodIds()
This is public in order to allow
the various Item instances to add items to the
instance and help early counting of method ids.
non-null; the method identifiers sectionpublic Statistics getStatistics()
non-null; the statistics