[代码片段]打印Manifest文件部分内容

       

	public static void printManifestContent(Manifest mf) {
		Attributes attributes = mf.getMainAttributes();
		Set<Entry<Object, Object>> entrySet = attributes.entrySet();
		for (Iterator iterator = entrySet.iterator(); iterator.hasNext();) {
			Entry<Object, Object> entry = (java.util.Map.Entry) iterator.next();
			System.out.println(entry.getKey() + "---=" + entry.getValue());
		}
	}

	public static Manifest getManifestFromJar(File jarFile) {
		try {
			return new JarFile(jarFile).getManifest();
		} catch (Exception e) {
			e.printStackTrace();
		}
		return null;
	}

 

       结果如下:

Implementation-Title---=  ojdbc14.jar
Implementation-Version---=Oracle JDBC Driver version - "10.2.0.3.0"
Implementation-Time---=   Fri Sep 29 09:43:24 2006
Sealed---=true
Specification-Vendor---=  Oracle Corporation
Specification-Title---=   Oracle JDBC driver classes for use with JDK14
Created-By---=1.4.2_08 (Sun Microsystems Inc.)
Specification-Version---= Oracle JDBC Driver version - "10.2.0.3.0"
Manifest-Version---=1.0
Implementation-Vendor---= Oracle Corporation

    全文完。

你可能感兴趣的:(Manifest)