@Override public void setJ2SELibraries(JarFile[] libs) { if (libs == null) { throw new IllegalArgumentException("libs is null"); } this.j2seLibs = new Module[libs.length]; for (int i = 0; i < libs.length; i++) { j2seLibs[i] = new JarFileModule(libs[i]); } }
@Override public Iterator<ModuleEntry> getEntries() { HashSet<ModuleEntry> result = HashSetFactory.make(); for (Enumeration e = file.entries(); e.hasMoreElements();) { ZipEntry Z = (ZipEntry) e.nextElement(); result.add(createEntry(Z)); } return result.iterator(); }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; NestedJarFileModule other = (NestedJarFileModule) obj; if (parent == null) { if (other.parent != null) return false; } else if (!parent.equals(other.parent)) return false; return true; }
private static void computeClassPath(AnalysisScope scope) { StringBuilder buf = new StringBuilder(); ClassLoaderReference cl = scope.getApplicationLoader(); while (cl != null) { List<Module> modules = scope.getModules(cl); for (Module m : modules) { if (buf.length() > 0) buf.append(File.pathSeparator); if (m instanceof JarFileModule) { JarFileModule jarFileModule = (JarFileModule) m; buf.append(jarFileModule.getAbsolutePath()); } else if (m instanceof DirectoryTreeModule) { DirectoryTreeModule directoryTreeModule = (DirectoryTreeModule) m; buf.append(directoryTreeModule.getPath()); } else Assertions.UNREACHABLE("Module entry is neither jar file nor directory"); } cl = cl.getParent(); } }
public JarFile getJarFile() { return jarFileModule.getJarFile(); }
@Override public InputStream getNestedContents() { return new ByteArrayInputStream(parent.getContents(entry)); }
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((parent == null) ? 0 : parent.hashCode()); return result; }
JarFileModule jarFileModule = (JarFileModule) m; libs.add(jarFileModule.getAbsolutePath()); } else if (m instanceof JarStreamModule) { try {
public JarFile getJarFile() { return jarFileModule.getJarFile(); }
@Override public InputStream getNestedContents() { return new ByteArrayInputStream(parent.getContents(entry)); }
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((parent == null) ? 0 : parent.hashCode()); return result; }
@Override public void setJ2SELibraries(JarFile[] libs) { if (libs == null) { throw new IllegalArgumentException("libs is null"); } this.j2seLibs = new Module[libs.length]; for (int i = 0; i < libs.length; i++) { j2seLibs[i] = new JarFileModule(libs[i]); } }
public static String getJavaJar(AnalysisScope javaScope) throws IOException { Module javaJar = javaScope.getModules(javaScope.getApplicationLoader()).iterator().next(); if (javaJar instanceof JarFileModule) { String javaJarPath = ((JarFileModule)javaJar).getAbsolutePath(); return javaJarPath; } else { assert javaJar instanceof NestedJarFileModule : javaJar; File F = File.createTempFile("android", ".jar"); //F.deleteOnExit(); System.err.println(F.getAbsolutePath()); TemporaryFile.streamToFile(F, ((NestedJarFileModule)javaJar).getNestedContents()); return F.getAbsolutePath(); } }
public long getSize() { // TODO: cache this? return jarFileModule.getJarFile().getEntry(entryName).getSize(); }
@Override public Iterator<ModuleEntry> getEntries() { HashSet<ModuleEntry> result = HashSetFactory.make(); for (Enumeration e = file.entries(); e.hasMoreElements();) { ZipEntry Z = (ZipEntry) e.nextElement(); result.add(createEntry(Z)); } return result.iterator(); }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; NestedJarFileModule other = (NestedJarFileModule) obj; if (parent == null) { if (other.parent != null) return false; } else if (!parent.equals(other.parent)) return false; return true; }
/** * Add a jar file to the scope for a loader */ @SuppressWarnings("unused") public void addToScope(ClassLoaderReference loader, JarFile file) { List<Module> s = MapUtil.findOrCreateList(moduleMap, loader); if (DEBUG_LEVEL > 0) { System.err.println(("AnalysisScope: add JarFileModule " + file.getName())); } s.add(new JarFileModule(file)); }
if (m instanceof JarFileModule) { moduleType = "jarFile"; modulePath = ((JarFileModule) m).getAbsolutePath(); } else if (m instanceof BinaryDirectoryTreeModule) { moduleType = "binaryDir";
@Override public int hashCode() { return entryName.hashCode() * 5059 + jarFileModule.getJarFile().hashCode(); }
/** * Add a jar file to the scope for a loader */ @SuppressWarnings("unused") public void addToScope(ClassLoaderReference loader, JarFile file) { List<Module> s = MapUtil.findOrCreateList(moduleMap, loader); if (DEBUG_LEVEL > 0) { System.err.println(("AnalysisScope: add JarFileModule " + file.getName())); } s.add(new JarFileModule(file)); }