public class DexArchive extends Archive
Modifier and Type | Method and Description |
---|---|
protected void |
downloadArchive(java.io.InputStream is,
java.net.URL source)
Create an Archive based on contents of an InputStream, the archive is saved
as local copy in the specified directory.
|
boolean |
exists(java.lang.String path,
boolean onlyDirs)
Get a BundleResourceStream to named entry inside an Archive.
|
byte[] |
getClassBytes(java.lang.String name)
Return null to indicate that we can not get class bytes from DEX files
|
java.lang.Class<?> |
loadClassBytes(java.lang.String name,
java.lang.ClassLoader cl)
Load a class using the Dalvik DexFile API.
|
protected void |
restoreArchive()
Create an Archive based on contents of a saved archive in the specified
directory.
|
protected Archive |
subArchive(java.lang.String path,
int id)
Create a Sub-Archive based on a path to in an already existing Archive.
|
checkNativeLibrary, findResourcesPath, getBundleGeneration, getBundleResourceStream, getFile, getNativeLibrary, getSubId, isJar, listDir, toString
protected void downloadArchive(java.io.InputStream is, java.net.URL source) throws java.io.IOException
Archive
downloadArchive
in class Archive
is
- Jar file data in an InputStream.java.io.IOException
protected void restoreArchive() throws java.io.IOException
Archive
restoreArchive
in class Archive
java.io.IOException
protected Archive subArchive(java.lang.String path, int id) throws java.io.IOException
Archive
subArchive
in class Archive
path
- Path of new Archive inside old Archive.id
- Sub-id of Archive.java.io.FileNotFoundException
- if no such Jar file in archive.java.io.IOException
- if failed to read Jar file.public boolean exists(java.lang.String path, boolean onlyDirs)
Archive
exists
in interface FileArchive
exists
in class Archive
public byte[] getClassBytes(java.lang.String name)
getClassBytes
in interface FileArchive
getClassBytes
in class Archive
name
- File to get.public java.lang.Class<?> loadClassBytes(java.lang.String name, java.lang.ClassLoader cl)
This relies in the bundle having a "classes.dex" in its root
TODO: We should create a specific bundle storage module for DEX files.
To create such a bundle, do
dx --dex --output=classes.dex bundle.jar
aapt add bundle.jar classes.dex
loadClassBytes
in interface FileArchive
loadClassBytes
in class Archive
cl
- Class loader to use for component.