本文整理汇总了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;
}
示例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);
}
}
}
示例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;
}
示例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);
}
示例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);
}