java.util.jar
Class Attributes

java.lang.Object sample code for java.lang.Object definition code for java.lang.Object 
  extended by java.util.jar.Attributes
All Implemented Interfaces:
Cloneable sample code for java.lang.Cloneable definition code for java.lang.Cloneable , Map sample code for java.util.Map definition code for java.util.Map <Object sample code for java.lang.Object definition code for java.lang.Object ,Object sample code for java.lang.Object definition code for java.lang.Object >

public class Attributes
extends Object sample code for java.lang.Object definition code for java.lang.Object
implements Map sample code for java.util.Map definition code for java.util.Map <Object sample code for java.lang.Object definition code for java.lang.Object ,Object sample code for java.lang.Object definition code for java.lang.Object >, Cloneable sample code for java.lang.Cloneable definition code for java.lang.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.

Since:
1.2
See Also:
Manifest sample code for java.util.jar.Manifest definition code for java.util.jar.Manifest

Nested Class Summary
static class Attributes.Name sample code for java.util.jar.Attributes.Name definition code for java.util.jar.Attributes.Name
          The Attributes.Name class represents an attribute name stored in this Map.
 
Nested classes/interfaces inherited from interface java.util.Map sample code for java.util.Map definition code for java.util.Map
Map.Entry sample code for java.util.Map.Entry definition code for java.util.Map.Entry <K,V>
 
Field Summary
protected  Map sample code for java.util.Map definition code for java.util.Map <Object sample code for java.lang.Object definition code for java.lang.Object ,Object sample code for java.lang.Object definition code for java.lang.Object > map sample code for java.util.jar.Attributes.map definition code for java.util.jar.Attributes.map
          The attribute name-value mappings.
 
Constructor Summary
Attributes sample code for java.util.jar.Attributes.Attributes() definition code for java.util.jar.Attributes.Attributes() ()
          Constructs a new, empty Attributes object with default size.
Attributes sample code for java.util.jar.Attributes.Attributes(java.util.jar.Attributes) definition code for java.util.jar.Attributes.Attributes(java.util.jar.Attributes) (Attributes sample code for java.util.jar.Attributes definition code for java.util.jar.Attributes  attr)
          Constructs a new Attributes object with the same attribute name-value mappings as in the specified Attributes.
Attributes sample code for java.util.jar.Attributes.Attributes(int) definition code for java.util.jar.Attributes.Attributes(int) (int size)
          Constructs a new, empty Attributes object with the specified initial size.
 
Method Summary
 void clear sample code for java.util.jar.Attributes.clear() definition code for java.util.jar.Attributes.clear() ()
          Removes all attributes from this Map.
 Object sample code for java.lang.Object definition code for java.lang.Object clone sample code for java.util.jar.Attributes.clone() definition code for java.util.jar.Attributes.clone() ()
          Returns a copy of the Attributes, implemented as follows:
 boolean containsKey sample code for java.util.jar.Attributes.containsKey(java.lang.Object) definition code for java.util.jar.Attributes.containsKey(java.lang.Object) (Object sample code for java.lang.Object definition code for java.lang.Object  name)
          Returns true if this Map contains the specified attribute name (key).
 boolean containsValue sample code for java.util.jar.Attributes.containsValue(java.lang.Object) definition code for java.util.jar.Attributes.containsValue(java.lang.Object) (Object sample code for java.lang.Object definition code for java.lang.Object  value)
          Returns true if this Map maps one or more attribute names (keys) to the specified value.
 Set sample code for java.util.Set definition code for java.util.Set <Map.Entry sample code for java.util.Map.Entry definition code for java.util.Map.Entry <Object sample code for java.lang.Object definition code for java.lang.Object ,Object sample code for java.lang.Object definition code for java.lang.Object >> entrySet sample code for java.util.jar.Attributes.entrySet() definition code for java.util.jar.Attributes.entrySet() ()
          Returns a Collection view of the attribute name-value mappings contained in this Map.
 boolean equals sample code for java.util.jar.Attributes.equals(java.lang.Object) definition code for java.util.jar.Attributes.equals(java.lang.Object) (Object sample code for java.lang.Object definition code for java.lang.Object  o)
          Compares the specified Attributes object with this Map for equality.
 Object sample code for java.lang.Object definition code for java.lang.Object get sample code for java.util.jar.Attributes.get(java.lang.Object) definition code for java.util.jar.Attributes.get(java.lang.Object) (Object sample code for java.lang.Object definition code for java.lang.Object  name)
          Returns the value of the specified attribute name, or null if the attribute name was not found.
 String sample code for java.lang.String definition code for java.lang.String getValue sample code for java.util.jar.Attributes.getValue(java.util.jar.Attributes.Name) definition code for java.util.jar.Attributes.getValue(java.util.jar.Attributes.Name) (Attributes.Name sample code for java.util.jar.Attributes.Name definition code for java.util.jar.Attributes.Name  name)
          Returns the value of the specified Attributes.Name, or null if the attribute was not found.
 String sample code for java.lang.String definition code for java.lang.String getValue sample code for java.util.jar.Attributes.getValue(java.lang.String) definition code for java.util.jar.Attributes.getValue(java.lang.String) (String sample code for java.lang.String definition code for java.lang.String  name)
          Returns the value of the specified attribute name, specified as a string, or null if the attribute was not found.
 int hashCode sample code for java.util.jar.Attributes.hashCode() definition code for java.util.jar.Attributes.hashCode() ()
          Returns the hash code value for this Map.
 boolean isEmpty sample code for java.util.jar.Attributes.isEmpty() definition code for java.util.jar.Attributes.isEmpty() ()
          Returns true if this Map contains no attributes.
 Set sample code for java.util.Set definition code for java.util.Set <Object sample code for java.lang.Object definition code for java.lang.Object > keySet sample code for java.util.jar.Attributes.keySet() definition code for java.util.jar.Attributes.keySet() ()
          Returns a Set view of the attribute names (keys) contained in this Map.
 Object sample code for java.lang.Object definition code for java.lang.Object put sample code for java.util.jar.Attributes.put(java.lang.Object, java.lang.Object) definition code for java.util.jar.Attributes.put(java.lang.Object, java.lang.Object) (Object sample code for java.lang.Object definition code for java.lang.Object  name, Object sample code for java.lang.Object definition code for java.lang.Object  value)
          Associates the specified value with the specified attribute name (key) in this Map.
 void putAll sample code for java.util.jar.Attributes.putAll(java.util.Map) definition code for java.util.jar.Attributes.putAll(java.util.Map) (Map sample code for java.util.Map definition code for java.util.Map <?,?> attr)
          Copies all of the attribute name-value mappings from the specified Attributes to this Map.
 String sample code for java.lang.String definition code for java.lang.String putValue sample code for java.util.jar.Attributes.putValue(java.lang.String, java.lang.String) definition code for java.util.jar.Attributes.putValue(java.lang.String, java.lang.String) (String sample code for java.lang.String definition code for java.lang.String  name, String sample code for java.lang.String definition code for java.lang.String  value)
          Associates the specified value with the specified attribute name, specified as a String.
 Object sample code for java.lang.Object definition code for java.lang.Object remove sample code for java.util.jar.Attributes.remove(java.lang.Object) definition code for java.util.jar.Attributes.remove(java.lang.Object) (Object sample code for java.lang.Object definition code for java.lang.Object  name)
          Removes the attribute with the specified name (key) from this Map.
 int size sample code for java.util.jar.Attributes.size() definition code for java.util.jar.Attributes.size() ()
          Returns the number of attributes in this Map.
 Collection sample code for java.util.Collection definition code for java.util.Collection <Object sample code for java.lang.Object definition code for java.lang.Object > values sample code for java.util.jar.Attributes.values() definition code for java.util.jar.Attributes.values() ()
          Returns a Collection view of the attribute values contained in this Map.
 
Methods inherited from class java.lang.Object sample code for java.lang.Object definition code for java.lang.Object
finalize sample code for java.lang.Object.finalize() definition code for java.lang.Object.finalize() , getClass sample code for java.lang.Object.getClass() definition code for java.lang.Object.getClass() , notify sample code for java.lang.Object.notify() definition code for java.lang.Object.notify() , notifyAll sample code for java.lang.Object.notifyAll() definition code for java.lang.Object.notifyAll() , toString sample code for java.lang.Object.toString() definition code for java.lang.Object.toString() , wait sample code for java.lang.Object.wait() definition code for java.lang.Object.wait() , wait sample code for java.lang.Object.wait(long) definition code for java.lang.Object.wait(long) , wait sample code for java.lang.Object.wait(long, int) definition code for java.lang.Object.wait(long, int)
 

Field Detail

map sample code for java.util.jar.Attributes.map

protected Map sample code for java.util.Map definition code for java.util.Map <Object sample code for java.lang.Object definition code for java.lang.Object ,Object sample code for java.lang.Object definition code for java.lang.Object > map
The attribute name-value mappings.

Constructor Detail

Attributes sample code for java.util.jar.Attributes() definition code for java.util.jar.Attributes()

public Attributes()
Constructs a new, empty Attributes object with default size.


Attributes sample code for java.util.jar.Attributes(int) definition code for java.util.jar.Attributes(int)

public Attributes(int size)
Constructs a new, empty Attributes object with the specified initial size.

Parameters:
size - the initial number of attributes

Attributes sample code for java.util.jar.Attributes(java.util.jar.Attributes) definition code for java.util.jar.Attributes(java.util.jar.Attributes)

public Attributes(Attributes sample code for java.util.jar.Attributes definition code for java.util.jar.Attributes  attr)
Constructs a new Attributes object with the same attribute name-value mappings as in the specified Attributes.

Parameters:
attr - the specified Attributes
Method Detail

get sample code for java.util.jar.Attributes.get(java.lang.Object) definition code for java.util.jar.Attributes.get(java.lang.Object)

public Object sample code for java.lang.Object definition code for java.lang.Object  get(Object sample code for java.lang.Object definition code for java.lang.Object  name)
Returns the value of the specified attribute name, or null if the attribute name was not found.

Specified by:
get sample code for java.util.Map.get(java.lang.Object) definition code for java.util.Map.get(java.lang.Object) in interface Map sample code for java.util.Map definition code for java.util.Map <Object sample code for java.lang.Object definition code for java.lang.Object ,Object sample code for java.lang.Object definition code for java.lang.Object >
Parameters:
name - the attribute name
Returns:
the value of the specified attribute name, or null if not found.
See Also:
Map.containsKey(Object) sample code for java.util.Map.containsKey(java.lang.Object) definition code for java.util.Map.containsKey(java.lang.Object)

getValue sample code for java.util.jar.Attributes.getValue(java.lang.String) definition code for java.util.jar.Attributes.getValue(java.lang.String)

public String sample code for java.lang.String definition code for java.lang.String  getValue(String sample code for java.lang.String definition code for java.lang.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 defined as:

            return (String)get(new Attributes.Name((String)name));
 

Parameters:
name - the attribute name as a string
Returns:
the String value of the specified attribute name, or null if not found.
Throws:
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - if the attribute name is invalid

getValue sample code for java.util.jar.Attributes.getValue(java.util.jar.Attributes.Name) definition code for java.util.jar.Attributes.getValue(java.util.jar.Attributes.Name)

public String sample code for java.lang.String definition code for java.lang.String  getValue(Attributes.Name sample code for java.util.jar.Attributes.Name definition code for java.util.jar.Attributes.Name  name)
Returns the value of the specified Attributes.Name, or null if the attribute was not found.

This method is defined as:

     return (String)get(name);
 

Parameters:
name - the Attributes.Name object
Returns:
the String value of the specified Attribute.Name, or null if not found.

put sample code for java.util.jar.Attributes.put(java.lang.Object, java.lang.Object) definition code for java.util.jar.Attributes.put(java.lang.Object, java.lang.Object)

public Object sample code for java.lang.Object definition code for java.lang.Object  put(Object sample code for java.lang.Object definition code for java.lang.Object  name,
                  Object sample code for java.lang.Object definition code for java.lang.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.

Specified by:
put sample code for java.util.Map.put(K, V) definition code for java.util.Map.put(K, V) in interface Map sample code for java.util.Map definition code for java.util.Map <Object sample code for java.lang.Object definition code for java.lang.Object ,Object sample code for java.lang.Object definition code for java.lang.Object >
Parameters:
name - the attribute name
value - the attribute value
Returns:
the previous value of the attribute, or null if none
Throws:
ClassCastException sample code for java.lang.ClassCastException definition code for java.lang.ClassCastException - if the name is not a Attributes.Name or the value is not a String

putValue sample code for java.util.jar.Attributes.putValue(java.lang.String, java.lang.String) definition code for java.util.jar.Attributes.putValue(java.lang.String, java.lang.String)

public String sample code for java.lang.String definition code for java.lang.String  putValue(String sample code for java.lang.String definition code for java.lang.String  name,
                       String sample code for java.lang.String definition code for java.lang.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 defined as:

            return (String)put(new Attributes.Name(name), value);
 

Parameters:
name - the attribute name as a string
value - the attribute value
Returns:
the previous value of the attribute, or null if none
Throws:
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - if the attribute name is invalid

remove sample code for java.util.jar.Attributes.remove(java.lang.Object) definition code for java.util.jar.Attributes.remove(java.lang.Object)

public Object sample code for java.lang.Object definition code for java.lang.Object  remove(Object sample code for java.lang.Object definition code for java.lang.Object  name)
Removes the attribute with the specified name (key) from this Map. Returns the previous attribute value, or null if none.

Specified by:
remove sample code for java.util.Map.remove(java.lang.Object) definition code for java.util.Map.remove(java.lang.Object) in interface Map sample code for java.util.Map definition code for java.util.Map <Object sample code for java.lang.Object definition code for java.lang.Object ,Object sample code for java.lang.Object definition code for java.lang.Object >
Parameters:
name - attribute name
Returns:
the previous value of the attribute, or null if none

containsValue sample code for java.util.jar.Attributes.containsValue(java.lang.Object) definition code for java.util.jar.Attributes.containsValue(java.lang.Object)

public boolean containsValue(Object sample code for java.lang.Object definition code for java.lang.Object  value)
Returns true if this Map maps one or more attribute names (keys) to the specified value.

Specified by:
containsValue sample code for java.util.Map.containsValue(java.lang.Object) definition code for java.util.Map.containsValue(java.lang.Object) in interface Map sample code for java.util.Map definition code for java.util.Map <Object sample code for java.lang.Object definition code for java.lang.Object ,Object sample code for java.lang.Object definition code for java.lang.Object >
Parameters:
value - the attribute value
Returns:
true if this Map maps one or more attribute names to the specified value

containsKey sample code for java.util.jar.Attributes.containsKey(java.lang.Object) definition code for java.util.jar.Attributes.containsKey(java.lang.Object)

public boolean containsKey(Object sample code for java.lang.Object definition code for java.lang.Object  name)
Returns true if this Map contains the specified attribute name (key).

Specified by:
containsKey sample code for java.util.Map.containsKey(java.lang.Object) definition code for java.util.Map.containsKey(java.lang.Object) in interface Map sample code for java.util.Map definition code for java.util.Map <Object sample code for java.lang.Object definition code for java.lang.Object ,Object sample code for java.lang.Object definition code for java.lang.Object >
Parameters:
name - the attribute name
Returns:
true if this Map contains the specified attribute name

putAll sample code for java.util.jar.Attributes.putAll(java.util.Map<?, ?>) definition code for java.util.jar.Attributes.putAll(java.util.Map<?, ?>)

public void putAll(Map sample code for java.util.Map definition code for java.util.Map <?,?> attr)
Copies all of the attribute name-value mappings from the specified Attributes to this Map. Duplicate mappings will be replaced.

Specified by:
putAll sample code for java.util.Map.putAll(java.util.Map) definition code for java.util.Map.putAll(java.util.Map) in interface Map sample code for java.util.Map definition code for java.util.Map <Object sample code for java.lang.Object definition code for java.lang.Object ,Object sample code for java.lang.Object definition code for java.lang.Object >
Parameters:
attr - the Attributes to be stored in this map
Throws:
ClassCastException sample code for java.lang.ClassCastException definition code for java.lang.ClassCastException - if attr is not an Attributes

clear sample code for java.util.jar.Attributes.clear() definition code for java.util.jar.Attributes.clear()

public void clear()
Removes all attributes from this Map.

Specified by:
clear sample code for java.util.Map.clear() definition code for java.util.Map.clear() in interface Map sample code for java.util.Map definition code for java.util.Map <Object sample code for java.lang.Object definition code for java.lang.Object ,Object sample code for java.lang.Object definition code for java.lang.Object >

size sample code for java.util.jar.Attributes.size() definition code for java.util.jar.Attributes.size()

public int size()
Returns the number of attributes in this Map.

Specified by:
size sample code for java.util.Map.size() definition code for java.util.Map.size() in interface Map sample code for java.util.Map definition code for java.util.Map <Object sample code for java.lang.Object definition code for java.lang.Object ,Object sample code for java.lang.Object definition code for java.lang.Object >
Returns:
the number of key-value mappings in this map.

isEmpty sample code for java.util.jar.Attributes.isEmpty() definition code for java.util.jar.Attributes.isEmpty()

public boolean isEmpty()
Returns true if this Map contains no attributes.

Specified by:
isEmpty sample code for java.util.Map.isEmpty() definition code for java.util.Map.isEmpty() in interface Map sample code for java.util.Map definition code for java.util.Map <Object sample code for java.lang.Object definition code for java.lang.Object ,Object sample code for java.lang.Object definition code for java.lang.Object >
Returns:
true if this map contains no key-value mappings.

keySet sample code for java.util.jar.Attributes.keySet() definition code for java.util.jar.Attributes.keySet()

public Set sample code for java.util.Set definition code for java.util.Set <Object sample code for java.lang.Object definition code for java.lang.Object > keySet()
Returns a Set view of the attribute names (keys) contained in this Map.

Specified by:
keySet sample code for java.util.Map.keySet() definition code for java.util.Map.keySet() in interface Map sample code for java.util.Map definition code for java.util.Map <Object sample code for java.lang.Object definition code for java.lang.Object ,Object sample code for java.lang.Object definition code for java.lang.Object >
Returns:
a set view of the keys contained in this map.

values sample code for java.util.jar.Attributes.values() definition code for java.util.jar.Attributes.values()

public Collection sample code for java.util.Collection definition code for java.util.Collection <Object sample code for java.lang.Object definition code for java.lang.Object > values()
Returns a Collection view of the attribute values contained in this Map.

Specified by:
values sample code for java.util.Map.values() definition code for java.util.Map.values() in interface Map sample code for java.util.Map definition code for java.util.Map <Object sample code for java.lang.Object definition code for java.lang.Object ,Object sample code for java.lang.Object definition code for java.lang.Object >
Returns:
a collection view of the values contained in this map.

entrySet sample code for java.util.jar.Attributes.entrySet() definition code for java.util.jar.Attributes.entrySet()

public Set sample code for java.util.Set definition code for java.util.Set <Map.Entry sample code for java.util.Map.Entry definition code for java.util.Map.Entry <Object sample code for java.lang.Object definition code for java.lang.Object ,Object sample code for java.lang.Object definition code for java.lang.Object >> entrySet()
Returns a Collection view of the attribute name-value mappings contained in this Map.

Specified by:
entrySet sample code for java.util.Map.entrySet() definition code for java.util.Map.entrySet() in interface Map sample code for java.util.Map definition code for java.util.Map <Object sample code for java.lang.Object definition code for java.lang.Object ,Object sample code for java.lang.Object definition code for java.lang.Object >
Returns:
a set view of the mappings contained in this map.

equals sample code for java.util.jar.Attributes.equals(java.lang.Object) definition code for java.util.jar.Attributes.equals(java.lang.Object)

public boolean equals(Object sample code for java.lang.Object definition code for java.lang.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.

Specified by:
equals sample code for java.util.Map.equals(java.lang.Object) definition code for java.util.Map.equals(java.lang.Object) in interface Map sample code for java.util.Map definition code for java.util.Map <Object sample code for java.lang.Object definition code for java.lang.Object ,Object sample code for java.lang.Object definition code for java.lang.Object >
Overrides:
equals sample code for java.lang.Object.equals(java.lang.Object) definition code for java.lang.Object.equals(java.lang.Object) in class Object sample code for java.lang.Object definition code for java.lang.Object
Parameters:
o - the Object to be compared
Returns:
true if the specified Object is equal to this Map
See Also:
Object.hashCode() sample code for java.lang.Object.hashCode() definition code for java.lang.Object.hashCode() , Hashtable sample code for java.util.Hashtable definition code for java.util.Hashtable

hashCode sample code for java.util.jar.Attributes.hashCode() definition code for java.util.jar.Attributes.hashCode()

public int hashCode()
Returns the hash code value for this Map.

Specified by:
hashCode sample code for java.util.Map.hashCode() definition code for java.util.Map.hashCode() in interface Map sample code for java.util.Map definition code for java.util.Map <Object sample code for java.lang.Object definition code for java.lang.Object ,Object sample code for java.lang.Object definition code for java.lang.Object >
Overrides:
hashCode sample code for java.lang.Object.hashCode() definition code for java.lang.Object.hashCode() in class Object sample code for java.lang.Object definition code for java.lang.Object
Returns:
a hash code value for this object.
See Also:
Object.equals(java.lang.Object) sample code for java.lang.Object.equals(java.lang.Object) definition code for java.lang.Object.equals(java.lang.Object) , Hashtable sample code for java.util.Hashtable definition code for java.util.Hashtable

clone sample code for java.util.jar.Attributes.clone() definition code for java.util.jar.Attributes.clone()

public Object sample code for java.lang.Object definition code for java.lang.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 sample code for java.lang.Object.clone() definition code for java.lang.Object.clone() in class Object sample code for java.lang.Object definition code for java.lang.Object
Returns:
a clone of this instance.
See Also:
Cloneable sample code for java.lang.Cloneable definition code for java.lang.Cloneable