Java Jar Manifest formatDisplay(String src, Manifest manifest)

Here you can find the source of formatDisplay(String src, Manifest manifest)

Description

Given a manifest, it appends vendor and version information to a given source string

License

Open Source License

Parameter

Parameter Description
src source string to append info to
manifest jar manifest file that contains vendor and version info.

Return

src string + appended version and vendor info.

Declaration

private static String formatDisplay(String src, Manifest manifest) 

Method Source Code

//package com.java2s;

import java.util.jar.Manifest;

public class Main {
    public static final String ATT_VERSION = "Implementation-Version";
    public static final String ATT_VENDOR = "Implementation-Vendor";

    /**//from  w  ww.  j a  va2  s . c o m
     * Given a manifest, it appends vendor and version information to a given
     * source string
     * @param src source string to append info to
     * @param manifest jar manifest file that contains vendor and version info.
     * @return src string + appended version and vendor info.
     */
    private static String formatDisplay(String src, Manifest manifest) {
        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");
    }
}

Related

  1. convertManifest(Manifest manifest)
  2. createManifest()
  3. createManifest(Map customFields)
  4. createManifest(String manifestVerion, String mainClass, String jarInternalClasspath)
  5. createTestManifest(Attributes.Name name, String value)
  6. generateEmptyManifest()
  7. getAttribute(final Manifest manifest, final String name, final String defValue)
  8. getAttribute(String attributeName, Manifest manifest)
  9. getBundleClassPath(Manifest manifest)