All Packages Class Hierarchy This Package Previous Next Index
Class java.util.jar.Attributes
java.lang.Object
|
+----java.util.jar.Attributes
- public class Attributes
- extends Object
- implements Map, Cloneable
The Attributes class maps Manifest attribute names to associated string
values. Attribute names are case-insensitive and restricted to the ASCII
characters in the set [0-9a-zA-Z_-]. Attribute values can contain any
characters and will be UTF8-encoded when written to the output stream.
- Since:
- JDK1.2
- See Also:
- Manifest
Attributes.Name- The Attributes.Name class represents an attribute name stored in
this Map.
amap- The attribute name-value mappings.
Attributes()
- Constructs a new, empty Attributes object.
Attributes(Attributes)
- Constructs a new Attributes object with the same attribute name-value
mappings as in the specified Attributes.
clear()
- Removes all attributes from this Map.
clone()
- Returns a copy of the Attributes, implemented as follows:
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.
containsKey(Object)
- Returns true if this Map contains the specified attribute name (key).
containsValue(Object)
- Returns true if this Map maps one or more attribute names (keys)
to the specified value.
entries()
- Returns a Collection view of the attribute name-value mappings
contained in this Map.
equals(Object)
- Compares the specified Attributes object with this Map for equality.
get(Object)
- Returns the value of the specified attribute name, or null if the
attribute name was not found.
getValue(Attributes.Name)
- Returns the value of the specified Attributes.Name, or null if the
attribute was not found.
getValue(String)
- Returns the value of the specified attribute name, specified as
a string, or null if the attribute was not found.
hashCode()
- Returns the hash code value for this Map.
isEmpty()
- Returns true if this Map contains no attributes.
keySet()
- Returns a Set view of the attribute names (keys) contained in this Map.
put(Object, Object)
- Associates the specified value with the specified attribute name
(key) in this Map.
putAll(Map)
- Copies all of the attribute name-value mappings from the specified
Attributes to this Map.
putValue(String, String)
- Associates the specified value with the specified attribute name,
specified as a String.
remove(Object)
- Removes the attribute with the specified name (key) from this Map.
size()
- Returns the number of attributes in this Map.
values()
- Returns a Collection view of the attribute values contained in this Map.
amap
protected Map amap
- The attribute name-value mappings.
Attributes
public Attributes()
- Constructs a new, empty Attributes object.
Attributes
public Attributes(Attributes attr)
- Constructs a new Attributes object with the same attribute name-value
mappings as in the specified Attributes.
get
public Object get(Object name)
- Returns the value of the specified attribute name, or null if the
attribute name was not found.
- Parameters:
- name - the attribute name
- Throws:
ClassCastException
- if name is not a Attributes.Name
- Throws:
NullPointerException
- if name is null
getValue
public String getValue(String name)
- Returns the value of the specified attribute name, specified as
a string, or null if the attribute was not found. The attribute
name is case-insensitive.
This method is merely shorthand for the expression:
(String)get(new Attributes.Name((String)name));
- Parameters:
- name - the attribute name as a string
- Throws:
NullPointerException
- if the name is null
getValue
public String getValue(Attributes.Name name)
- Returns the value of the specified Attributes.Name, or null if the
attribute was not found.
This method is merely shorthand for the expression:
(String)get(name)
- Parameters:
- name - the Attributes.Name object
- Throws:
NullPointerException
- if name is null
put
public Object put(Object name,
Object value)
- Associates the specified value with the specified attribute name
(key) in this Map. If the Map previously contained a mapping for
the attribute name, the old value is replaced.
- Parameters:
- name - the attribute name
- value - the attribute value
- Returns:
- the previous value of the attribute, or null if none
- Throws:
ClassCastException
- if the name is not a Attributes.Name
or the value is not a String
putValue
public String putValue(String name,
String value)
- Associates the specified value with the specified attribute name,
specified as a String. The attributes name is case-insensitive.
If the Map previously contained a mapping for the attribute name,
the old value is replaced.
This method is merely shorthand for the expression:
(String)put(new Attributes.Name(name), value);
- Parameters:
- the - attribute name as a string
- value - the attribute value
- Throws:
IllegalArgumentException
- if the attribute name is invalid
- Throws:
NullPointerException
- if name or value is null
remove
public Object remove(Object name)
- Removes the attribute with the specified name (key) from this Map.
Returns the previous attribute value, or null if none.
- Parameters:
- name - attribute name
- Throws:
ClassCastException
- if the name is not a Attributes.Name
- Throws:
NullPointerException
- if the name is null
containsValue
public boolean containsValue(Object value)
- Returns true if this Map maps one or more attribute names (keys)
to the specified value.
- Parameters:
- value - the attribute value
containsKey
public boolean containsKey(Object name)
- Returns true if this Map contains the specified attribute name (key).
- Parameters:
- name - the attribute name
- Throws:
ClassCastException
- if the name is not a Attributes.Name
- Throws:
NullPointerException
- if the name is null
putAll
public void putAll(Map attr)
- Copies all of the attribute name-value mappings from the specified
Attributes to this Map. Duplicate mappings will be replaced.
- Parameters:
- attr - the Attributes to be stored in this map
- Throws:
ClassCastException
- if attr is not an instance of Attributes
- Throws:
NullPointerException
- if attr is null
clear
public void clear()
- Removes all attributes from this Map.
size
public int size()
- Returns the number of attributes in this Map.
isEmpty
public boolean isEmpty()
- Returns true if this Map contains no attributes.
keySet
public Set keySet()
- Returns a Set view of the attribute names (keys) contained in this Map.
values
public Collection values()
- Returns a Collection view of the attribute values contained in this Map.
entries
public Collection entries()
- Returns a Collection view of the attribute name-value mappings
contained in this Map.
equals
public boolean equals(Object o)
- Compares the specified Attributes object with this Map for equality.
Returns true if the given object is also an instance of Attributes
and the two Attributes objects represent the same mappings.
- Parameters:
- o - the Object to be compared
- Returns:
- true if the specified Object is equal to this Map
- Overrides:
- equals in class Object
hashCode
public int hashCode()
- Returns the hash code value for this Map.
- Overrides:
- hashCode in class Object
clone
public Object clone()
- Returns a copy of the Attributes, implemented as follows:
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.
- Overrides:
- clone in class Object
All Packages Class Hierarchy This Package Previous Next Index
Submit a bug or feature