List of utility methods to do Jar Manifest
String | getManifestValue(JarFile jarFile, String key, String defaultValue) get Manifest Value final Manifest manifest = getManifest(jarFile); if (manifest == null) { return defaultValue; final Attributes attributes = manifest.getMainAttributes(); final String value = attributes.getValue(key); if (value == null) { return defaultValue; ... |
String | getManifestVersionNumber(File file) get Manifest Version Number JarFile jar = new JarFile(file); Manifest manifest = jar.getManifest(); String versionNumber = null; java.util.jar.Attributes attributes = manifest.getMainAttributes(); if (attributes != null) { Iterator it = attributes.keySet().iterator(); while (it.hasNext()) { Attributes.Name key = (Attributes.Name) it.next(); ... |
Object | getValueFromAttr(Attributes attributes, String manifestValue) get Value From Attr for (Object key : attributes.keySet()) { if (key.toString().equals(manifestValue)) return attributes.get(key); return null; |
boolean | isOSGiManifest(Manifest manifest) is OS Gi Manifest Attributes mainAttributes = manifest.getMainAttributes(); return mainAttributes.containsKey(new Attributes.Name("Bundle-Name")); |
Properties | manifestToProperties(Attributes d) manifest To Properties Iterator iter = d.keySet().iterator(); Properties result = new Properties(); while (iter.hasNext()) { Attributes.Name key = (Attributes.Name) iter.next(); result.put(key.toString(), d.get(key)); return result; |
void | merge(Manifest into, Manifest from) Merge entries from two Manifests together, with existing attributes being overwritten. Attributes attributes = from.getMainAttributes(); if (attributes != null) { for (Map.Entry<Object, Object> attribute : attributes.entrySet()) { into.getMainAttributes().put(attribute.getKey(), attribute.getValue()); Map<String, Attributes> entries = from.getEntries(); if (entries != null) { ... |
Manifest | stripManifest(Manifest manifestIn) strip Manifest Manifest manifestOut = new Manifest(manifestIn); for (Map.Entry<String, Attributes> entry : manifestIn.getEntries().entrySet()) { manifestOut.getEntries().remove(entry.getKey()); return manifestOut; |