8 import java.io.FileOutputStream;
9 import java.io.IOException;
10 import java.io.InputStream;
12 import android.content.Context;
13 import android.util.Log;
14 import dalvik.system.DexClassLoader;
30 private String lastFile = null;
46 String file =
"tmpdex" + System.currentTimeMillis() +
".jar";
47 Log.d(
"DexHelper",
"Using temporary dex-jarfile " + file);
50 c.deleteFile(lastFile);
52 String[] files = c.fileList();
53 System.out.println(files);
54 FileOutputStream f = c.openFileOutput(file, Context.MODE_WORLD_READABLE);
56 byte[] buffer =
new byte[1024];
58 while ((len1 = in.read(buffer)) > 0) {
59 f.write(buffer, 0, len1);
62 Log.d(
"DexHelper",
"Finished preparing local copy of jar-file input stream" + file);
63 }
catch (IOException e) {
64 Log.e(
"DexHelper",
"I/O exception while preparing local copy of jar-file input stream", e);
77 c.deleteFile(lastFile);
static String APP_DATA_DIRECTORY
The directory where the application may write data to and read from.
ClassLoader getDexClassLoader(InputStream in)
Class that contains miscellaneous JaRMoS specific constants and static functions. ...
Utility class for providing class loaders that load from dex-jarfiles.