本文整理了Java中java.util.jar.Attributes.<init>()
方法的一些代码示例,展示了Attributes.<init>()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Attributes.<init>()
方法的具体详情如下:
包路径:java.util.jar.Attributes
类名称:Attributes
方法名:<init>
[英]Constructs an Attributes instance.
[中]构造属性实例。
代码示例来源:origin: chewiebug/GCViewer
/**
* Returns Manifest-Attributes for MANIFEST.MF, if running for a .jar file
*
* @return Manifest Attributes (may be empty but never null)
* @throws IOException If something went wrong finding the MANIFEST file
* @see <a href="http://stackoverflow.com/a/1273432">stackoverflow article</a>
*/
private static Attributes getAttributes() throws IOException {
Class clazz = BuildInfoReader.class;
String className = clazz.getSimpleName() + ".class";
String classPath = clazz.getResource(className).toString();
if (!classPath.startsWith("jar")) {
// Class not from JAR
return new Attributes(0);
}
String manifestPath = classPath.substring(0, classPath.lastIndexOf("!") + 1) + FILE_NAME;
Manifest manifest = new Manifest(new URL(manifestPath).openStream());
return manifest.getMainAttributes();
}
代码示例来源:origin: pxb1988/dex2jar
attr = input.getAttributes(name);
attr = attr != null ? new Attributes(attr) : new Attributes();
attr.putValue(digName, encodeBase64(md.digest()));
output.getEntries().put(name, attr);
代码示例来源:origin: Meituan-Dianping/walle
Attributes mainAttrs = new Attributes();
for (String entryName : sortedEntryNames) {
byte[] entryDigest = jarEntryDigests.get(entryName);
Attributes entryAttrs = new Attributes();
entryAttrs.putValue(
entryDigestAttributeName,
代码示例来源:origin: Meituan-Dianping/walle
byte[] sectionContents = manifestSection.getValue();
byte[] sectionDigest = md.digest(sectionContents);
Attributes attrs = new Attributes();
attrs.putValue(
entryDigestAttributeName,
代码示例来源:origin: xalan/xalan
final JavaClass clazz = (JavaClass)classes.nextElement();
final String className = clazz.getClassName().replace('.','/');
final java.util.jar.Attributes attr = new java.util.jar.Attributes();
attr.put(dateAttr, now);
map.put(className+".class", attr);
代码示例来源:origin: robovm/robovm
public void readEntries(Map<String, Attributes> entries, Map<String, Manifest.Chunk> chunks) throws IOException {
int mark = pos;
while (readHeader()) {
if (!Attributes.Name.NAME.equals(name)) {
throw new IOException("Entry is not named");
}
String entryNameValue = value;
Attributes entry = entries.get(entryNameValue);
if (entry == null) {
entry = new Attributes(12);
}
while (readHeader()) {
entry.put(name, value);
}
if (chunks != null) {
if (chunks.get(entryNameValue) != null) {
// TODO A bug: there might be several verification chunks for
// the same name. I believe they should be used to update
// signature in order of appearance; there are two ways to fix
// this: either use a list of chunks, or decide on used
// signature algorithm in advance and reread the chunks while
// updating the signature; for now a defensive error is thrown
throw new IOException("A jar verifier does not support more than one entry with the same name");
}
chunks.put(entryNameValue, new Manifest.Chunk(mark, pos));
mark = pos;
}
entries.put(entryNameValue, entry);
}
}
代码示例来源:origin: pxb1988/dex2jar
print.flush();
Attributes sfAttr = new Attributes();
sfAttr.putValue(digName, encodeBase64(md.digest()));
sf.getEntries().put(entry.getKey(), sfAttr);
代码示例来源:origin: robovm/robovm
Attributes temp = new Attributes(3);
temp.map.put("hidden", null);
mEntry.setAttributes(temp);
代码示例来源:origin: robovm/robovm
Attributes attributes = new Attributes();
HashMap<String, Attributes> entries = new HashMap<String, Attributes>();
try {
代码示例来源:origin: org.codehaus.plexus/plexus-archiver
private Attributes getOrCreateAttributes( String name )
{
Attributes attributes = getAttributes( name );
if ( attributes == null )
{
attributes = new Attributes();
getEntries().put( name, attributes );
}
return attributes;
}
代码示例来源:origin: org.eclipse/org.eclipse.jst.j2ee.core
/**
* Creates a new manifest entry (attributes) for the given name
*/
public void addEntry(String entryName) {
Attributes attr = new Attributes();
addEntry(entryName, attr);
}
代码示例来源:origin: stackoverflow.com
Attributes attrs = new BasicAttributes(true);
attr = new BasicAttribute("PTR");
attr.add(0, "eg-www.apple.com.");
attr.add(1, "www.apple.com.");
attrs.put(attr);
代码示例来源:origin: com.github.japgolly.android.test/robolectric
@Override public void run() {
Manifest manifest = new Manifest();
Attributes attributes = new Attributes();
attributes.put(VERSION_ATTRIBUTE, String.valueOf(expectedCacheVersion));
manifest.getEntries().put("robolectric", attributes);
saveAllClassesToCache(cacheJarFile, manifest);
}
});
代码示例来源:origin: stackoverflow.com
String DN = "cn="+a.get("cn").replaceAll(" ","")+",ou=Users"+",dc=example,dc=com";
Attribute dn = new BasicAttribute("dn",DN);
Attribute cn = new BasicAttribute("cn",a.get("cn"));
Attribute objectClass = new BasicAttribute("objectClass", "inetOrgPerson");
...
Attributes atts = new BasicAttributes();
atts.put(dn);
atts.put(cn);
atts.put(objectClass);
ctx.createSubcontext(DN, atts);
代码示例来源:origin: org.jboss.shrinkwrap.descriptors/shrinkwrap-descriptors-impl-base
@Override
void includeAttribute(Name attribute, String value) {
Map<String, Attributes> entries = manifest.getEntries();
Attributes attributes = entries.containsKey(entryName) ? manifest.getAttributes(entryName) : new Attributes();
attributes.put(attribute, value);
entries.put(entryName, attributes);
}
代码示例来源:origin: org.projectodd.shrinkwrap.descriptors/shrinkwrap-descriptors-impl-base
@Override
void includeAttribute(Name attribute, String value) {
Map<String, Attributes> entries = manifest.getEntries();
Attributes attributes = entries.containsKey(entryName) ? manifest.getAttributes(entryName) : new Attributes();
attributes.put(attribute, value);
entries.put(entryName, attributes);
}
代码示例来源:origin: org.apache.ace/org.apache.ace.util
public Attributes getManifestAttributes(boolean fixPackage) {
Attributes a = new Attributes();
a.putValue("Bundle-SymbolicName", getSymbolicName());
a.putValue("Bundle-Version", getVersion());
return a;
}
代码示例来源:origin: org.apache.aries.application/org.apache.aries.application.resolver.obr
public Attributes getRawAttributes()
{
Attributes _attributes = new Attributes();
_attributes.putAll(attributes);
_attributes.putAll(directives);
return _attributes;
}
}
代码示例来源:origin: apache/aries
public Attributes getRawAttributes()
{
Attributes _attributes = new Attributes();
_attributes.putAll(attributes);
_attributes.putAll(directives);
return _attributes;
}
}
代码示例来源:origin: cdapio/cdap
private static Manifest createManifest(Object...entries) {
Preconditions.checkArgument(entries.length % 2 == 0);
Attributes attributes = new Attributes();
for (int i = 0; i < entries.length; i += 2) {
attributes.put(entries[i], entries[i + 1]);
}
Manifest manifest = new Manifest();
manifest.getMainAttributes().putAll(attributes);
return manifest;
}
}
内容来源于网络,如有侵权,请联系作者删除!