Package com.android.builder.dexing
Interface DexArchive
- All Superinterfaces:
AutoCloseable,Closeable
Interface describing the DEX archive. It contains one DEX file per .class file that was processed
i.e. each DEX file in it, contains definition of exactly one class. Also, the directory structure
is preserved e.g. if a file com/example/tools/A.class was processed, it will have relative path
com/example/tools/A.dex in the archive.
Dex archives can be updated by adding new files.
When using instances of DexArchive make sure that you invoke Closeable.close() after
you are done using it.
-
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a DEX file to this dex archive from a byte[].Returns the path to this DEX archive.Returns all dex archive entries in this dex archive.
-
Method Details
-
getRootPath
Returns the path to this DEX archive.- Returns:
- path to this archive
-
addFile
Adds a DEX file to this dex archive from a byte[]. Adding is performed relative to thegetRootPath(). In case file with the same relative path already exists, implementations of this method should overwrite it with the new version of the file.- Parameters:
relativePath- file to be added to this archivebytes- the buffer to get the dex file content fromoffset- the offset for the buffer window.end- the end of the buffer window.- Throws:
IOException- if the dex file cannot be written.
-
getSortedDexArchiveEntries
Returns all dex archive entries in this dex archive.The dex archive entries are sorted to ensure deterministic order.
-