当前位置: 首页>>代码示例>>Java>>正文


Java Manifest.read方法代码示例

本文整理汇总了Java中java.util.jar.Manifest.read方法的典型用法代码示例。如果您正苦于以下问题:Java Manifest.read方法的具体用法?Java Manifest.read怎么用?Java Manifest.read使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.util.jar.Manifest的用法示例。


在下文中一共展示了Manifest.read方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: loadPublicPackagesPatterns

import java.util.jar.Manifest; //导入方法依赖的package包/类
private static List<Pattern> loadPublicPackagesPatterns(Project project) {
    List<Pattern> toRet = new ArrayList<Pattern>();
    String[] params = PluginPropertyUtils.getPluginPropertyList(project, 
            MavenNbModuleImpl.GROUPID_MOJO, MavenNbModuleImpl.NBM_PLUGIN, //NOI18N
            "publicPackages", "publicPackage", "manifest"); //NOI18N
    if (params != null) {
        toRet = prepareMavenPublicPackagesPatterns(params);
    } else {
        FileObject obj = project.getProjectDirectory().getFileObject(MANIFEST_PATH);
        if (obj != null) {
            InputStream in = null;
            try {
                in = obj.getInputStream();
                Manifest man = new Manifest();
                man.read(in);
                String value = man.getMainAttributes().getValue(ATTR_PUBLIC_PACKAGE);
                toRet = prepareManifestPublicPackagesPatterns(value);
            } catch (Exception ex) {
                Exceptions.printStackTrace(ex);
            } finally {
                IOUtil.close(in);
            }
        }
    }
    return toRet;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:27,代码来源:AccessQueryImpl.java

示例2: verwerkManifest

import java.util.jar.Manifest; //导入方法依赖的package包/类
private void verwerkManifest(final Path tmpFolder, final FileTime bestandstijd, final JarOutputStream nieuwArchiefStream) throws MojoExecutionException {
    final File archiefBestand = new File(tmpFolder.toFile(), JarFile.MANIFEST_NAME);
    getLog().debug("Processing manifest");
    if (archiefBestand.exists()) {
        try (final FileInputStream fis = new FileInputStream(archiefBestand)) {
            Manifest manifest = new Manifest();
            if (archiefBestand.exists()) {
                manifest.read(fis);
            }
            ZipEntry manifestFolder = new ZipEntry(META_INF_PATH);
            fixeerDatumTijd(manifestFolder, bestandstijd);
            nieuwArchiefStream.putNextEntry(manifestFolder);
            nieuwArchiefStream.closeEntry();
            ZipEntry manifestBestand = new ZipEntry(JarFile.MANIFEST_NAME);
            fixeerDatumTijd(manifestBestand, bestandstijd);
            nieuwArchiefStream.putNextEntry(manifestBestand);
            manifest.write(nieuwArchiefStream);
            nieuwArchiefStream.closeEntry();
            getLog().debug("manifest processed");
        } catch (IOException e) {
            throw new MojoExecutionException("Cannot write manifest file", e);
        }
    }
}
 
开发者ID:MinBZK,项目名称:OperatieBRP,代码行数:25,代码来源:TimestampMojo.java

示例3: loadManifest

import java.util.jar.Manifest; //导入方法依赖的package包/类
private static Manifest loadManifest(File mani) throws IOException {
    Manifest m = new Manifest();
    if (mani != null) {
        InputStream is = new FileInputStream(mani);
        try {
            m.read(is);
        } finally {
            is.close();
        }
    }
    m.getMainAttributes().putValue("Manifest-Version", "1.0"); // workaround for JDK bug
    return m;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:14,代码来源:SetupHid.java

示例4: findClass

import java.util.jar.Manifest; //导入方法依赖的package包/类
protected Class findClass (final String name) throws ClassNotFoundException {
    if (!fast && name.indexOf ('.') != -1) {
        Logger.getLogger(NbClassLoader.class.getName()).log(Level.FINE, "NBFS used!");
        String pkg = name.substring (0, name.lastIndexOf ('.'));
        if (getPackage (pkg) == null) {
            String resource = name.replace ('.', '/') + ".class"; // NOI18N
            URL[] urls = getURLs ();
            for (int i = 0; i < urls.length; i++) {
                // System.err.println (urls[i].toString ());
                FileObject root = URLMapper.findFileObject(urls[i]);

                if (root == null) {
                    continue;
                }
                try {
                    FileObject fo = root.getFileObject(resource);

                    if (fo != null) {
                        // Got it. If there is an associated manifest, load it.
                        FileObject manifo = root.getFileObject("META-INF/MANIFEST.MF");

                        if (manifo == null)
                            manifo = root.getFileObject("meta-inf/manifest.mf");
                        if (manifo != null) {
                            // System.err.println (manifo.toString () + " " + manifo.getClass ().getName () + " " + manifo.isValid ());
                            Manifest mani = new Manifest();
                            InputStream is = manifo.getInputStream();

                            try {
                                mani.read(is);
                            }
                            finally {
                                is.close();
                            }
                            definePackage(pkg, mani, urls[i]);
                        }
                        break;
                    }
                }
                catch (IOException ioe) {
                    Exceptions.attachLocalizedMessage(ioe,
                                                      urls[i].toString());
                    Exceptions.printStackTrace(ioe);
                    continue;
                }
            }
        }
    }
    return super.findClass (name);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:51,代码来源:NbClassLoader.java

示例5: getManifestParameter

import java.util.jar.Manifest; //导入方法依赖的package包/类
/**
 * retrieves the context salience from the class provided
 *
 * @param clazz
 * @return string containing context salience
 * @throws IOException
 */
public static String getManifestParameter(Class clazz) throws IOException {
    Manifest mf = new Manifest();
    mf.read(clazz.getClassLoader().getResourceAsStream(META_INF_MANIFEST_FILE));

    return getManifestParameter(mf, true);
}
 
开发者ID:jaffa-projects,项目名称:jaffa-framework,代码行数:14,代码来源:ContextHelper.java


注:本文中的java.util.jar.Manifest.read方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。