Java Jar Manifest convertManifest(Manifest manifest)

Here you can find the source of convertManifest(Manifest manifest)

Description

convert Manifest

License

Open Source License

Declaration

@SuppressWarnings("rawtypes")
    public static Properties convertManifest(Manifest manifest) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2011 Gerd Wuetherich (gerd@gerd-wuetherich.de).
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 * /*from w ww. j a v a 2 s  .  co  m*/
 * Contributors:
 *     Gerd Wuetherich (gerd@gerd-wuetherich.de) - initial API and implementation
 ******************************************************************************/

import java.util.Iterator;

import java.util.Properties;
import java.util.jar.Attributes;

import java.util.jar.Manifest;

public class Main {
    @SuppressWarnings("rawtypes")
    public static Properties convertManifest(Manifest 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;
    }
}

Related

  1. checkManifestForR(java.util.jar.JarFile jar)
  2. createManifest()
  3. createManifest(Map customFields)
  4. createManifest(String manifestVerion, String mainClass, String jarInternalClasspath)
  5. createTestManifest(Attributes.Name name, String value)