本文整理了Java中java.util.jar.Attributes.remove()
方法的一些代码示例,展示了Attributes.remove()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Attributes.remove()
方法的具体详情如下:
包路径:java.util.jar.Attributes
类名称:Attributes
方法名:remove
[英]Deletes the key/value pair with key key from this Attributes.
[中]从该属性中删除具有密钥的密钥/值对。
代码示例来源:origin: org.codehaus.plexus/plexus-archiver
public void removeAttribute( String attributeName )
{
backingAttributes.remove( new Attributes.Name( attributeName ) );
}
代码示例来源:origin: alipay/sofa-ark
@Override
public Object remove(Object name) {
linkedHashMap.remove(name);
return super.remove(name);
}
代码示例来源:origin: dsyer/spring-boot-thin-launcher
private Manifest buildManifest(JarFile archive) throws IOException {
Manifest manifest = archive.getManifest();
// The repackager looks for this attribute and bails out if it finds it
manifest.getMainAttributes().remove(new Attributes.Name(BOOT_VERSION_ATTRIBUTE));
// We also want to replace this with the default one from the repackager
manifest.getMainAttributes().remove(Attributes.Name.MAIN_CLASS);
if (this.mainClass != null) {
manifest.getMainAttributes().put(Attributes.Name.MAIN_CLASS, this.mainClass);
}
return manifest;
}
代码示例来源:origin: org.eclipse/org.eclipse.jst.j2ee.core
public void removeEntryAttribute(String entryName, Object key) {
Attributes attr = getAttributes(entryName);
if (attr != null)
attr.remove(key);
}
代码示例来源:origin: biz.aQute.bnd/bnd
private void doHeader(Attributes main, String header) {
String value = annotationHeaders.getHeader(header);
if (value != null && main.getValue(header) == null) {
if (value.trim().length() == 0)
main.remove(header);
else if (value.trim().equals(EMPTY_HEADER))
main.putValue(header, "");
else
main.putValue(header, value);
}
}
代码示例来源:origin: biz.aQute.bnd/bndlib
private void doHeader(Attributes main, String header) {
String value = annotationHeaders.getHeader(header);
if (value != null && main.getValue(header) == null) {
if (value.trim().length() == 0)
main.remove(header);
else if (value.trim().equals(EMPTY_HEADER))
main.putValue(header, "");
else
main.putValue(header, value);
}
}
代码示例来源:origin: com.atlassian.plugins/atlassian-plugins-osgi
private void writeManifestOverride(final TransformContext context, final Manifest mf)
throws IOException {
// Removing this field makes the generated manifest deterministic
final Attributes.Name lastModifiedKey = new Attributes.Name("Bnd-LastModified");
mf.getMainAttributes().remove(lastModifiedKey);
final ByteArrayOutputStream bout = new ByteArrayOutputStream();
mf.write(bout);
context.getFileOverrides().put("META-INF/MANIFEST.MF", bout.toByteArray());
}
代码示例来源:origin: org.apache.brooklyn/brooklyn-rt-felix
private static byte[] buildExtensionBundle(Manifest manifest) throws IOException {
Attributes atts = manifest.getMainAttributes();
//the following properties are invalid in extension bundles
atts.remove(new Attributes.Name(Constants.IMPORT_PACKAGE));
atts.remove(new Attributes.Name(Constants.REQUIRE_BUNDLE));
atts.remove(new Attributes.Name(Constants.BUNDLE_NATIVECODE));
atts.remove(new Attributes.Name(Constants.DYNAMICIMPORT_PACKAGE));
atts.remove(new Attributes.Name(Constants.BUNDLE_ACTIVATOR));
//mark as extension bundle
atts.putValue(Constants.FRAGMENT_HOST, "system.bundle; extension:=framework");
//create the jar containing the manifest
ByteArrayOutputStream jar = new ByteArrayOutputStream();
JarOutputStream out = new JarOutputStream(jar, manifest);
out.close();
return jar.toByteArray();
}
代码示例来源:origin: biz.aQute.bnd/biz.aQute.bndlib
private void doHeader(Attributes main, String header) {
String value = annotationHeaders.getHeader(header);
if (value == null)
return;
Name name = new Name(header);
if (main.getValue(name) != null)
return;
String trimmed = value.trim();
if (trimmed.isEmpty())
main.remove(name);
else if (EMPTY_HEADER.equals(trimmed))
main.put(name, "");
else
main.put(name, value);
}
代码示例来源:origin: biz.aQute.bnd/biz.aQute.bnd
private void doHeader(Attributes main, String header) {
String value = annotationHeaders.getHeader(header);
if (value == null)
return;
Name name = new Name(header);
if (main.getValue(name) != null)
return;
String trimmed = value.trim();
if (trimmed.isEmpty())
main.remove(name);
else if (EMPTY_HEADER.equals(trimmed))
main.put(name, "");
else
main.put(name, value);
}
代码示例来源:origin: org.eclipse/org.eclipse.jst.j2ee.core
/**
* @see com.ibm.etools.archive.ArchiveManifest
*/
public void setClassPath(java.lang.String aSpaceDelimitedPath) {
Attributes attributes = getMainAttributes();
if (aSpaceDelimitedPath == null)
attributes.remove(Attributes.Name.CLASS_PATH);
else
attributes.putValue(Attributes.Name.CLASS_PATH.toString(), aSpaceDelimitedPath);
}
代码示例来源:origin: org.eclipse/org.eclipse.jst.j2ee.core
/**
* @see com.ibm.etools.archive.ArchiveManifest
*/
public void setMainClass(java.lang.String className) {
Attributes attributes = getMainAttributes();
if (className == null)
attributes.remove(Attributes.Name.MAIN_CLASS);
else
attributes.putValue(Attributes.Name.MAIN_CLASS.toString(), className);
}
代码示例来源:origin: org.eclipse/org.eclipse.jst.j2ee
protected void resetClassPath(List cp) {
ArchiveManifest mf = outgoingArchive.getManifest();
if (cp.isEmpty())
mf.getMainAttributes().remove(Attributes.Name.CLASS_PATH);
else {
mf.setClassPath("");//$NON-NLS-1$
for (int i = 0; i < cp.size(); i++) {
mf.appendClassPath((String) cp.get(i));
}
}
}
代码示例来源:origin: org.knopflerfish/framework
mainAttrs.remove(new Attributes.Name(key));
} else if("[autoexport]".equals(val)) {
final String exports = getExports();
mainAttrs.putValue(Constants.EXPORT_PACKAGE, exports);
} else {
mainAttrs.remove(new Attributes.Name(Constants.EXPORT_PACKAGE));
代码示例来源:origin: org.arquillian.liferay/arquillian-processor-osgi-allin
@Override
public Manifest cleanRepeatedImports(
Manifest manifest, Collection<Archive<?>> auxiliaryArchives)
throws IOException {
List<String> auxiliaryArchivesPackages = getAuxiliaryArchivesPackages(
auxiliaryArchives);
Attributes mainAttributes = manifest.getMainAttributes();
String importPackages = mainAttributes.getValue(IMPORT_PACKAGE);
mainAttributes.remove(new Attributes.Name(IMPORT_PACKAGE));
Map<String, Set<String>> importsWithDirectivesMap =
toImportsWithDirectivesMap(importPackages);
List<String> resultImports = new ArrayList<>();
for (String importValue : importsWithDirectivesMap.keySet()) {
if (auxiliaryArchivesPackages.contains(importValue)) {
continue;
}
StringBuilder sb = new StringBuilder();
sb.append(importValue);
for (String directive : importsWithDirectivesMap.get(importValue)) {
sb.append(";");
sb.append(directive);
}
resultImports.add(sb.toString());
}
ManifestManager manifestManager = _manifestManagerInstance.get();
manifest = manifestManager.putAttributeValue(
manifest, IMPORT_PACKAGE,
resultImports.toArray(new String[resultImports.size()]));
return manifest;
}
代码示例来源:origin: apache/felix
Manifest resultManifest = Utils.readManifest(manifestFile);
resultManifest.getMainAttributes().remove(new Name(Constants.DEPLOYMENTPACKAGE_FIXPACK));
String path = (String) iter.next();
Attributes sourceAttribute = (Attributes) resultManifest.getEntries().get(path);
if ("true".equals(sourceAttribute.remove(new Name(Constants.DEPLOYMENTPACKAGE_MISSING)))) {
targetFiles.remove(path);
代码示例来源:origin: biz.aQute.bnd/biz.aQute.bndlib
public byte[] getTimelessDigest() throws Exception {
check();
MessageDigest md = MessageDigest.getInstance("SHA1");
OutputStream dout = new DigestOutputStream(IO.nullStream, md);
// dout = System.out;
Manifest m = getManifest();
if (m != null) {
Manifest m2 = new Manifest(m);
Attributes main = m2.getMainAttributes();
String lastmodified = (String) main.remove(new Attributes.Name(Constants.BND_LASTMODIFIED));
String version = main.getValue(new Attributes.Name(Constants.BUNDLE_VERSION));
if (version != null && Verifier.isVersion(version)) {
Version v = new Version(version);
main.putValue(Constants.BUNDLE_VERSION, v.toStringWithoutQualifier());
}
writeManifest(m2, dout);
for (Map.Entry<String, Resource> entry : getResources().entrySet()) {
String path = entry.getKey();
if (path.equals(manifestName))
continue;
Resource resource = entry.getValue();
dout.write(path.getBytes(UTF_8));
resource.write(dout);
}
}
return md.digest();
}
代码示例来源:origin: biz.aQute.bnd/biz.aQute.bnd
public byte[] getTimelessDigest() throws Exception {
check();
MessageDigest md = MessageDigest.getInstance("SHA1");
OutputStream dout = new DigestOutputStream(IO.nullStream, md);
// dout = System.out;
Manifest m = getManifest();
if (m != null) {
Manifest m2 = new Manifest(m);
Attributes main = m2.getMainAttributes();
String lastmodified = (String) main.remove(new Attributes.Name(Constants.BND_LASTMODIFIED));
String version = main.getValue(new Attributes.Name(Constants.BUNDLE_VERSION));
if (version != null && Verifier.isVersion(version)) {
Version v = new Version(version);
main.putValue(Constants.BUNDLE_VERSION, v.toStringWithoutQualifier());
}
writeManifest(m2, dout);
for (Map.Entry<String, Resource> entry : getResources().entrySet()) {
String path = entry.getKey();
if (path.equals(manifestName))
continue;
Resource resource = entry.getValue();
dout.write(path.getBytes(UTF_8));
resource.write(dout);
}
}
return md.digest();
}
代码示例来源:origin: biz.aQute.bnd/bndlib
Manifest m2 = new Manifest(m);
Attributes main = m2.getMainAttributes();
String lastmodified = (String) main.remove(new Attributes.Name(Constants.BND_LASTMODIFIED));
String version = main.getValue(new Attributes.Name(Constants.BUNDLE_VERSION));
if ( version != null && Verifier.isVersion(version)) {
代码示例来源:origin: biz.aQute.bnd/bnd
Manifest m2 = new Manifest(m);
Attributes main = m2.getMainAttributes();
String lastmodified = (String) main.remove(new Attributes.Name(Constants.BND_LASTMODIFIED));
String version = main.getValue(new Attributes.Name(Constants.BUNDLE_VERSION));
if ( version != null && Verifier.isVersion(version)) {
内容来源于网络,如有侵权,请联系作者删除!