List of utility methods to do Jar Manifest
String[] | getBundleClassPath(Manifest manifest) get Bundle Class Path if (manifest == null) { return new String[0]; Attributes mainAttributes = manifest.getMainAttributes(); if (mainAttributes == null) { return new String[0]; String value = mainAttributes.getValue("Bundle-ClassPath"); ... |
String | getBundleVersion(Manifest manifest) get Bundle Version if (manifest == null) { return null; Attributes mainAttributes = manifest.getMainAttributes(); if (mainAttributes == null) { return null; return mainAttributes.getValue("Bundle-Version"); ... |
String | getHeader(String name, Manifest manifest) get Header String value = manifest.getMainAttributes().getValue(name);
return value;
|
String | getMainAttributeValue(Manifest manifest, String attribute) get Main Attribute Value String result = null; if (manifest != null && attribute != null) { Attributes attributes = manifest.getMainAttributes(); result = attributes.getValue(attribute); return result; |
Manifest | getManifest() Set up a new manifest. Manifest manifest = new Manifest(); Attributes mainAttrs = manifest.getMainAttributes(); mainAttrs.put(Attributes.Name.MANIFEST_VERSION, "1.0"); mainAttrs.putValue("Created-By", "LOCKSS"); return manifest; |
Manifest | getManifest() get Manifest Manifest manifest = new Manifest(); Attributes mainAttribs = manifest.getMainAttributes(); mainAttribs.put(Attributes.Name.MANIFEST_VERSION, "1.0"); mainAttribs.put(Attributes.Name.MAIN_CLASS, "com.jdojo.archives.Test"); mainAttribs.put(Attributes.Name.SEALED, "true"); Map<String, Attributes> attribsMap = manifest.getEntries(); Attributes a1 = getAttribute("Sealed", "false"); attribsMap.put("com/jdojo/archives/", a1); ... |
Manifest | getManifest(File file) get Manifest if (!file.exists()) { return null; Manifest manifest = null; if (file.isDirectory()) { File mf = new File(file, "META-INF/MANIFEST.MF"); if (mf.isFile()) { InputStream is = new FileInputStream(mf); ... |
Manifest | getManifest(File in) Assumes the given file is a jar and retrieves the manifest. JarFile jar = new JarFile(in); Manifest manifest = jar.getManifest(); jar.close(); return manifest; |
Manifest | getManifest(File jarFile) get Manifest return new JarFile(jarFile).getManifest(); |
Manifest | getManifest(File pluginFile) Obtains the manifest of the plugin file represented by the given deployment info. try { JarFile jarFile = new JarFile(pluginFile); try { Manifest manifest = jarFile.getManifest(); return manifest; } finally { jarFile.close(); } catch (Exception ignored) { return null; |