List of utility methods to do Jar Manifest
Manifest | getManifest(final String jarFileName) Gets the manifest object from jar file. final JarFile jarFile = new JarFile(jarFileName); final Manifest manifest = getManifest(jarFile); jarFile.close(); return manifest; |
Manifest | getManifest(JarFile pluginJarFile) get Manifest try { return pluginJarFile.getManifest(); } catch (IOException ex) { return null; |
Manifest | getManifest(String className) Return a Manifest which indicate the parameter as the class containing the main of the application. Manifest mf = new Manifest(); mf.getMainAttributes().put(Attributes.Name.MANIFEST_VERSION, "1.0"); mf.getMainAttributes().put(new Attributes.Name("Built-By"), "Sonet Nicolas"); mf.getMainAttributes().put(new Attributes.Name("Created-By"), "Sonet Nicolas"); mf.getMainAttributes().put(Attributes.Name.MAIN_CLASS, className); return mf; |
Manifest | getManifest(String path) get Manifest File jar = new File(path); JarFile jf = new JarFile(new File(path)); Manifest mf = new JarFile(jar).getManifest(); jf.close(); return mf; |
Manifest | getManifest(ZipFile zip) Use this utility to read Manifest from a JarFile or ZipFile due to http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6735255 ZipEntry entry = zip.getEntry("META-INF/MANIFEST.MF"); if (entry == null) return null; InputStream in = zip.getInputStream(entry); try { return new Manifest(in); } finally { in.close(); ... |
Manifest | getManifest(ZipFile zipFile) get Manifest ZipEntry manifestEntry = zipFile.getEntry(MANIFEST); return new Manifest(zipFile.getInputStream(manifestEntry)); |
String | getManifestAttribute(InputStream in, String attr) get Manifest Attribute try { Manifest manifest = new Manifest(in); Attributes attributes = manifest.getMainAttributes(); return attributes.getValue(attr); } catch (IOException ex) { throw new UncheckedIOException(ex); |
String | getManifestAttribute(Manifest m) get Manifest Attribute String value = null; if (m != null) { value = m.getMainAttributes().getValue("Cytoscape-Plugin"); return value; |
String | getManifestAttribute(String jarUrl, String attribute) Get an attribute value JarFile jar = new JarFile(jarUrl); Attributes attr = jar.getManifest().getMainAttributes(); String value = attr.getValue(attribute); jar.close(); return value; |
Hashtable | getManifestAttributes(File jarFile) get Manifest Attributes Hashtable<String, String> h = new Hashtable<String, String>(); JarFile jar = null; try { jar = new JarFile(jarFile); Manifest manifest = jar.getManifest(); h = getManifestAttributes(manifest); } catch (Exception ex) { h = null; ... |