public final class DexFile
extends java.lang.Object
.dex (Dalvik EXecutable)
file, which itself consists of a set of Dalvik classes.| Modifier and Type | Class and Description |
|---|---|
static class |
DexFile.Storage
Holder for a byte[] that can grow on demand.
|
| 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.
|
CallSiteIdsSection |
getCallSiteIds()
Gets the call site identifiers section.
|
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.
|
MethodHandlesSection |
getMethodHandles()
Gets the method handles section.
|
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. |
ByteArrayAnnotatedOutput |
writeTo(DexFile.Storage storage)
Writes the contents of this instance as a binary.
|
void |
writeTo(java.io.OutputStream out,
DexFile.Storage storage,
java.io.Writer humanOut,
boolean verbose)
Writes the contents of this instance as either a binary or a
human-readable form, or both.
|
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)
dexOptions - non-null; DEX file generations options to applypublic 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 void writeTo(java.io.OutputStream out,
DexFile.Storage storage,
java.io.Writer humanOut,
boolean verbose)
throws java.io.IOException
out - null-ok; where to write tostorage - temporary storage for storing dexing.humanOut - null-ok; where to write human-oriented output toverbose - whether to be verbose when writing human-oriented outputjava.io.IOExceptionpublic ByteArrayAnnotatedOutput writeTo(DexFile.Storage storage)
storage - temporary storage for storing dexing.public 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 MethodHandlesSection getMethodHandles()
This is public in order to allow
the various Item instances to add items to the
instance and help early counting of method handles.
non-null; the method handles sectionpublic CallSiteIdsSection getCallSiteIds()
This is public in order to allow
the various Item instances to add items to the
instance and help early counting of call site identifiers.
non-null; the call site identifiers sectionpublic Statistics getStatistics()
non-null; the statisticsCopyright © 2020. All Rights Reserved.