java.lang.Object | |
↳ | java.util.jar.Attributes |
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 Classes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Attributes.Name | The Attributes.Name class represents an attribute name stored in this Map. |
Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
map | The attribute name-value mappings. |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Constructs a new, empty Attributes object with default size.
| |||||||||||
Constructs a new, empty Attributes object with the specified
initial size.
| |||||||||||
Constructs a new Attributes object with the same attribute name-value
mappings as in the specified Attributes.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Removes all attributes from this Map.
| |||||||||||
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. | |||||||||||
Returns true if this Map contains the specified attribute name (key).
| |||||||||||
Returns true if this Map maps one or more attribute names (keys)
to the specified value.
| |||||||||||
Returns a Collection view of the attribute name-value mappings
contained in this Map.
| |||||||||||
Compares the specified Attributes object with this Map for equality.
| |||||||||||
Returns the value of the specified attribute name, or null if the
attribute name was not found.
| |||||||||||
Returns the value of the specified attribute name, specified as
a string, or null if the attribute was not found.
| |||||||||||
Returns the value of the specified Attributes.Name, or null if the
attribute was not found.
| |||||||||||
Returns the hash code value for this Map.
| |||||||||||
Returns true if this Map contains no attributes.
| |||||||||||
Returns a Set view of the attribute names (keys) contained in this Map.
| |||||||||||
Associates the specified value with the specified attribute name
(key) in this Map.
| |||||||||||
Copies all of the attribute name-value mappings from the specified
Attributes to this Map.
| |||||||||||
Associates the specified value with the specified attribute name,
specified as a String.
| |||||||||||
Removes the attribute with the specified name (key) from this Map.
| |||||||||||
Returns the number of attributes in this Map.
| |||||||||||
Returns a Collection view of the attribute values contained in this Map.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
| |||||||||||
From interface
java.util.Map
|
Constructs a new, empty Attributes object with default size.
Constructs a new, empty Attributes object with the specified initial size.
size | the initial number of attributes |
---|
Constructs a new Attributes object with the same attribute name-value mappings as in the specified Attributes.
attr | the specified Attributes |
---|
Removes all attributes from this Map.
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.
Returns true if this Map contains the specified attribute name (key).
name | the attribute name |
---|
Returns true if this Map maps one or more attribute names (keys) to the specified value.
value | the attribute value |
---|
Returns a Collection view of the attribute name-value mappings contained in this Map.
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.
o | the Object to be compared |
---|
Returns the value of the specified attribute name, or null if the attribute name was not found.
name | the attribute 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));
name | the attribute name as a string |
---|
IllegalArgumentException | if the attribute name is invalid |
---|
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);
name | the Attributes.Name object |
---|
Returns the hash code value for this Map.
Returns true if this Map contains no attributes.
Returns a Set view of the attribute names (keys) contained in this Map.
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.
name | the attribute name |
---|---|
value | the attribute value |
ClassCastException | if the name is not a Attributes.Name or the value is not a String |
---|
Copies all of the attribute name-value mappings from the specified Attributes to this Map. Duplicate mappings will be replaced.
attr | the Attributes to be stored in this map |
---|
ClassCastException | if attr is not an Attributes |
---|
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);
name | the attribute name as a string |
---|---|
value | the attribute value |
IllegalArgumentException | if the attribute name is invalid |
---|
Removes the attribute with the specified name (key) from this Map. Returns the previous attribute value, or null if none.
name | attribute name |
---|
Returns the number of attributes in this Map.
Returns a Collection view of the attribute values contained in this Map.