List of utility methods to do Jar Manifest
boolean | checkManifestForR(java.util.jar.JarFile jar) Checks the manifest of the Jar whether there is any R source code bundled with it. throw new RuntimeException(); |
Properties | convertManifest(Manifest manifest) convert Manifest Attributes attributes = manifest.getMainAttributes(); Iterator iter = attributes.keySet().iterator(); Properties result = new Properties(); while (iter.hasNext()) { Attributes.Name key = (Attributes.Name) iter.next(); result.put(key.toString(), attributes.get(key)); return result; ... |
Manifest | createManifest() create Manifest Manifest manifest = new Manifest(); manifest.getMainAttributes().put(Attributes.Name.MANIFEST_VERSION, "1.0"); manifest.getMainAttributes().put(Attributes.Name.IMPLEMENTATION_URL, "http://samoa.yahoo.com"); manifest.getMainAttributes().put(Attributes.Name.IMPLEMENTATION_VERSION, "0.1"); manifest.getMainAttributes().put(Attributes.Name.IMPLEMENTATION_VENDOR, "Yahoo"); manifest.getMainAttributes().put(Attributes.Name.IMPLEMENTATION_VENDOR_ID, "SAMOA"); Attributes s4Attributes = new Attributes(); s4Attributes.putValue("S4-App-Class", "path.to.Class"); ... |
Manifest | createManifest(Map create Manifest Manifest manifest = new Manifest(); manifest.getMainAttributes().put(Attributes.Name.MANIFEST_VERSION, "1.0"); for (String key : customFields.keySet()) { manifest.getMainAttributes().putValue(key, customFields.get(key)); return manifest; |
Manifest | createManifest(String manifestVerion, String mainClass, String jarInternalClasspath) create Manifest Manifest manifest = new Manifest(); Attributes manifestAttr = manifest.getMainAttributes(); if (manifestVerion != null) { manifestAttr.putValue("Manifest-Version", manifestVerion); if (mainClass != null) { manifestAttr.putValue("Main-Class", mainClass); if (jarInternalClasspath != null) { ... |
Manifest | createTestManifest(Attributes.Name name, String value) create Test Manifest return createTestManifest(Collections.singletonMap(name, value));
|
String | formatDisplay(String src, Manifest manifest) Given a manifest, it appends vendor and version information to a given source string String version = manifest.getMainAttributes().getValue(ATT_VERSION); String vendor = manifest.getMainAttributes().getValue(ATT_VENDOR); if (version == null) version = "NA"; if (vendor == null) vendor = "NA"; return (src + ": " + version + " (c) " + vendor + "\n"); |
Manifest | generateEmptyManifest() Generates a Jar Manifest based on the given parameters Manifest manifest = new Manifest(); manifest.getMainAttributes().put(Attributes.Name.MANIFEST_VERSION, "1.0"); return manifest; |
String | getAttribute(final Manifest manifest, final String name, final String defValue) get Attribute if (manifest == null) { return defValue; return manifest.getMainAttributes().getValue(name) != null ? manifest.getMainAttributes().getValue(name) : defValue; |
String | getAttribute(String attributeName, Manifest manifest) get Attribute Attributes attributes = manifest.getMainAttributes(); if (attributes == null) { return null; if (attributes.containsKey(attributeName)) { return attributes.getValue(attributeName); } else { return null; ... |