use of com.google.classyshark.silverghost.translator.java.clazz.reflect.MetaObjectClass in project android-classyshark by google.
the class MetaObjectFactory method getMetaObjectFromAar.
private static MetaObject getMetaObjectFromAar(String className, File archiveFile) {
try {
File file = File.createTempFile("classes", "jar");
file.deleteOnExit();
OutputStream out = new FileOutputStream(file);
FileInputStream fin = new FileInputStream(archiveFile);
BufferedInputStream bin = new BufferedInputStream(fin);
ZipInputStream zin = new ZipInputStream(bin);
ZipEntry ze;
while ((ze = zin.getNextEntry()) != null) {
if (ze.getName().endsWith(".jar")) {
byte[] buffer = new byte[8192];
int len;
while ((len = zin.read(buffer)) != -1) {
out.write(buffer, 0, len);
}
out.close();
MetaObject result = getMetaObjectFromJar(className, file);
return result;
}
}
} catch (Exception e) {
}
return new MetaObjectClass(Exception.class);
}
use of com.google.classyshark.silverghost.translator.java.clazz.reflect.MetaObjectClass in project android-classyshark by google.
the class MetaObjectFactory method getMetaObjectFromApk.
private static MetaObject getMetaObjectFromApk(String className, File apk) {
MetaObject result;
try {
File classesDexWithClass = MultidexReader.extractClassesDexWithClass(className, apk);
result = getMetaObjectFromDex(className, classesDexWithClass);
} catch (Exception e) {
result = new MetaObjectClass(Exception.class);
}
return result;
}
use of com.google.classyshark.silverghost.translator.java.clazz.reflect.MetaObjectClass in project android-classyshark by google.
the class MetaObjectFactory method getMetaObjectFromDex.
private static MetaObject getMetaObjectFromDex(String className, File archiveFile) {
MetaObject result;
try {
DexFile dexFile = DexlibLoader.loadDexFile(archiveFile);
ClassDef classDef = DexlibAdapter.getClassDefByName(className, dexFile);
result = new MetaObjectDex(classDef);
} catch (Exception e) {
result = new MetaObjectClass(Exception.class);
}
return result;
}
Aggregations