Class Dex
java.lang.Object
com.android.dex.Dex
The bytes of a dex file in memory for reading and writing. All int offsets
are unsigned.
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionappendSection(int maxByteCount, String name) intReturns the checksum of all but the first 12 bytes ofdex.byte[]Returns the signature of all but the first 32 bytes of this dex.intdescriptorIndexFromTypeIndex(int typeIndex) Look up a descriptor index from a type index.fieldIds()byte[]getBytes()Returns a copy of the the bytes of this dex.intintopen(int position) protoIds()readClassData(ClassDef classDef) readCode(ClassData.Method method) readTypeList(int offset) strings()typeIds()voidGenerates the signature and checksum of the dex fileoutand writes them to the file.voidvoidwriteTo(OutputStream out)
-
Constructor Details
-
Dex
Creates a new dex that reads fromdata. It is an error to modifydataafter using it to create a dex buffer.- Throws:
IOException
-
Dex
Creates a new empty dex of the specified size.- Throws:
IOException
-
Dex
Creates a new dex buffer of the dex inin, and closesin.- Throws:
IOException
-
Dex
Creates a new dex buffer from the dex filefile.- Throws:
IOException
-
-
Method Details
-
writeTo
- Throws:
IOException
-
writeTo
- Throws:
IOException
-
getTableOfContents
-
open
-
appendSection
-
getLength
public int getLength() -
getNextSectionStart
public int getNextSectionStart() -
getBytes
public byte[] getBytes()Returns a copy of the the bytes of this dex. -
strings
-
typeIds
-
typeNames
-
protoIds
-
fieldIds
-
methodIds
-
classDefs
-
readTypeList
-
readClassData
-
readCode
-
computeSignature
Returns the signature of all but the first 32 bytes of this dex. The first 32 bytes of dex files are not specified to be included in the signature.- Throws:
IOException
-
computeChecksum
Returns the checksum of all but the first 12 bytes ofdex.- Throws:
IOException
-
writeHashes
Generates the signature and checksum of the dex fileoutand writes them to the file.- Throws:
IOException
-
descriptorIndexFromTypeIndex
public int descriptorIndexFromTypeIndex(int typeIndex) Look up a descriptor index from a type index. Cheaper than:open(tableOfContents.typeIds.off + (index * SizeOf.TYPE_ID_ITEM)).readInt();
-