| |||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
JarURLConnection uc = …;
Attributes attr = uc.getMainAttributes();
Based on 19 examples
Manifest manifest = …;
Attributes attributes = manifest.getMainAttributes();
Based on 15 examples
public class Attributes extends Object implements Map, Cloneable
The Attributes class maps Manifest attribute names to associated string values. Valid attribute names are case-insensitive, are restricted to the ASCII characters in the set [0-9a-zA-Z_-], and cannot exceed 70 characters in length. Attribute values can contain any characters and will be UTF8-encoded when written to the output stream. See the JAR File Specification for more information about valid attribute names and values.
Nested Class Summary | |
---|---|
static class |
The Attributes.Name class represents an attribute name stored in this Map. |
Field Summary | |
---|---|
protected Map |
map
The attribute name-value mappings. |
Constructor Summary | |
---|---|
Constructs a new, empty Attributes object with default size. |
|
Attributes(Attributes attr) Constructs a new Attributes object with the same attribute name-value mappings as in the specified Attributes. |
|
Attributes(int size) Constructs a new, empty Attributes object with the specified initial size. |
Method Summary | |
---|---|
void |
clear() Removes all attributes from this Map. |
Object |
clone() Returns a copy of the Attributes, implemented as follows: |
boolean |
containsKey(Object name) Returns true if this Map contains the specified attribute name (key). |
boolean |
containsValue(Object value) Returns true if this Map maps one or more attribute names (keys) to the specified value. |
Set |
entrySet() Returns a Collection view of the attribute name-value mappings contained in this Map. |
boolean |
Compares the specified Attributes object with this Map for equality. |
Object |
Returns the value of the specified attribute name, or null if the attribute name was not found. |
String |
getValue(Attributes.Name name) Returns the value of the specified Attributes.Name, or null if the attribute was not found. |
String |
Returns the value of the specified attribute name, specified as a string, or null if the attribute was not found. |
int |
hashCode() Returns the hash code value for this Map. |
boolean |
isEmpty() Returns true if this Map contains no attributes. |
Set |
keySet() Returns a Set view of the attribute names (keys) contained in this Map. |
Object |
Associates the specified value with the specified attribute name (key) in this Map. |
void |
Copies all of the attribute name-value mappings from the specified Attributes to this Map. |
String |
Associates the specified value with the specified attribute name, specified as a String. |
Object |
Removes the attribute with the specified name (key) from this Map. |
int |
size() Returns the number of attributes in this Map. |
Collection |
values() Returns a Collection view of the attribute values contained in this Map. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected Map map
Constructor Detail |
---|
public Attributes()
public Attributes(Attributes attr)
attr
- the specified Attributespublic Attributes(int size)
size
- the initial number of attributesMethod Detail |
---|
public void clear()
public Object clone()
public Object clone() { return new Attributes(this); }Since the attribute names and values are themselves immutable, the Attributes returned can be safely modified without affecting the original.
clone
in class Object
public boolean containsKey(Object name)
name
- the attribute namepublic boolean containsValue(Object value)
value
- the attribute valuepublic Set entrySet()
public boolean equals(Object o)
equals
in class Object
o
- the Object to be comparedpublic Object get(Object name)
name
- the attribute namepublic String getValue(Attributes.Name name)
This method is defined as:
return (String)get(name);
name
- the Attributes.Name objectpublic String getValue(String name)
This method is defined as:
return (String)get(new Attributes.Name((String)name));
name
- the attribute name as a stringpublic int hashCode()
hashCode
in class Object
public boolean isEmpty()
public Set keySet()
public Object put(Object name, Object value)
name
- the attribute namevalue
- the attribute valuepublic void putAll(Map attr)
attr
- the Attributes to be stored in this mappublic String putValue(String name, String value)
This method is defined as:
return (String)put(new Attributes.Name(name), value);
name
- the attribute name as a stringvalue
- the attribute valuepublic Object remove(Object name)
name
- attribute namepublic int size()
public Collection values()
| |||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |