Added in API level 1

Attributes

open class Attributes : MutableMap<Any!, Any!>, Cloneable
kotlin.Any
   ↳ 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. There must be a colon and a SPACE after the name; the combined length will not exceed 72 characters. 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.

This map and its views have a predictable iteration order, namely the order that keys were inserted into the map, as with LinkedHashMap.

Summary

Nested classes
open

The Attributes.

Public constructors

Constructs a new, empty Attributes object with default size.

Attributes(size: Int)

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
open Unit

Removes all attributes from this Map.

open Any

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.

open Boolean

Returns true if this Map contains the specified attribute name (key).

open Boolean
containsValue(value: Any!)

Returns true if this Map maps one or more attribute names (keys) to the specified value.

open Boolean
equals(other: Any?)

Compares the specified object to the underlying map for equality.

open Any?
get(key: Any!)

Returns the value of the specified attribute name, or null if the attribute name was not found.

open String!
getValue(name: String!)

Returns the value of the specified attribute name, specified as a string, or null if the attribute was not found.

open String!

Returns the value of the specified Attributes.

open Int

Returns the hash code value for this Map.

open Boolean

Returns true if this Map contains no attributes.

open Any?
put(key: Any!, value: Any!)

Associates the specified value with the specified attribute name (key) in this Map.

open Unit
putAll(from: Map<*, *>)

Copies all of the attribute name-value mappings from the specified Attributes to this Map.

open String!
putValue(name: String!, value: String!)

Associates the specified value with the specified attribute name, specified as a String.

open Any?
remove(key: Any!)

Removes the attribute with the specified name (key) from this Map.

Properties
open MutableSet<MutableEntry<Any!, Any!>>

Returns a Collection view of the attribute name-value mappings contained in this Map.

open MutableSet<Any!>

Returns a Set view of the attribute names (keys) contained in this Map.

MutableMap<Any!, Any!>!

The attribute name-value mappings.

open Int

Returns the number of attributes in this Map.

open MutableCollection<Any!>

Returns a Collection view of the attribute values contained in this Map.

Public constructors

Attributes

Added in API level 1
Attributes()

Constructs a new, empty Attributes object with default size.

Attributes

Added in API level 1
Attributes(size: Int)

Constructs a new, empty Attributes object with the specified initial size.

Parameters
size Int: the initial number of attributes

Attributes

Added in API level 1
Attributes(attr: Attributes!)

Constructs a new Attributes object with the same attribute name-value mappings as in the specified Attributes.

Parameters
attr Attributes!: the specified Attributes

Public methods

clear

Added in API level 1
open fun clear(): Unit

Removes all attributes from this Map.

Exceptions
java.lang.UnsupportedOperationException if the clear operation is not supported by this map

clone

Added in API level 1
open fun clone(): Any

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.

Return
Any a clone of this instance.
Exceptions
java.lang.CloneNotSupportedException if the object's class does not support the Cloneable interface. Subclasses that override the clone method can also throw this exception to indicate that an instance cannot be cloned.

containsKey

Added in API level 1
open fun containsKey(key: Any!): Boolean

Returns true if this Map contains the specified attribute name (key).

Parameters
key Any!: key whose presence in this map is to be tested
name the attribute name
Return
Boolean true if this Map contains the specified attribute name
Exceptions
java.lang.ClassCastException if the key is of an inappropriate type for this map (optional)
java.lang.NullPointerException if the specified key is null and this map does not permit null keys (optional)

containsValue

Added in API level 1
open fun containsValue(value: Any!): Boolean

Returns true if this Map maps one or more attribute names (keys) to the specified value.

Parameters
value Any!: the attribute value
Return
Boolean true if this Map maps one or more attribute names to the specified value
Exceptions
java.lang.ClassCastException if the value is of an inappropriate type for this map (optional)
java.lang.NullPointerException if the specified value is null and this map does not permit null values (optional)

equals

Added in API level 1
open fun equals(other: Any?): Boolean

Compares the specified object to the underlying map for equality. Returns true if the given object is also a Map and the two maps represent the same mappings.

Parameters
obj the reference object with which to compare.
o the Object to be compared
Return
Boolean true if the specified Object is equal to this Map

get

Added in API level 1
open fun get(key: Any!): Any?

Returns the value of the specified attribute name, or null if the attribute name was not found.

Parameters
key Any!: the key whose associated value is to be returned
name the attribute name
Return
Any? the value of the specified attribute name, or null if not found.
Exceptions
java.lang.ClassCastException if the key is of an inappropriate type for this map (optional)
java.lang.NullPointerException if the specified key is null and this map does not permit null keys (optional)

getValue

Added in API level 1
open fun getValue(name: String!): String!

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 String!: the attribute name as a string
Return
String! the String value of the specified attribute name, or null if not found.
Exceptions
java.lang.IllegalArgumentException if the attribute name is invalid

getValue

Added in API level 1
open fun getValue(name: Attributes.Name!): String!

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 Attributes.Name!: the Attributes.Name object
Return
String! the String value of the specified Attribute.Name, or null if not found.

hashCode

Added in API level 1
open fun hashCode(): Int

Returns the hash code value for this Map.

Return
Int the hash code value for this map

isEmpty

Added in API level 1
open fun isEmpty(): Boolean

Returns true if this Map contains no attributes.

Return
Boolean true if this map contains no key-value mappings

put

Added in API level 1
open fun put(
    key: Any!,
    value: Any!
): Any?

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
key Any!: key with which the specified value is to be associated
value Any!: the attribute value
name the attribute name
Return
Any? the previous value of the attribute, or null if none
Exceptions
java.lang.UnsupportedOperationException if the put operation is not supported by this map
java.lang.ClassCastException if the name is not a Attributes.Name or the value is not a String
java.lang.NullPointerException if the specified key or value is null and this map does not permit null keys or values
java.lang.IllegalArgumentException if some property of the specified key or value prevents it from being stored in this map

putAll

Added in API level 1
open fun putAll(from: Map<*, *>): Unit

Copies all of the attribute name-value mappings from the specified Attributes to this Map. Duplicate mappings will be replaced.

Parameters
m mappings to be stored in this map
attr the Attributes to be stored in this map
Exceptions
java.lang.UnsupportedOperationException if the putAll operation is not supported by this map
java.lang.ClassCastException if attr is not an Attributes
java.lang.NullPointerException if the specified map is null, or if this map does not permit null keys or values, and the specified map contains null keys or values
java.lang.IllegalArgumentException if some property of a key or value in the specified map prevents it from being stored in this map

putValue

Added in API level 1
open fun putValue(
    name: String!,
    value: String!
): String!

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 String!: the attribute name as a string
value String!: the attribute value
Return
String! the previous value of the attribute, or null if none
Exceptions
java.lang.IllegalArgumentException if the attribute name is invalid

remove

Added in API level 1
open fun remove(key: Any!): Any?

Removes the attribute with the specified name (key) from this Map. Returns the previous attribute value, or null if none.

Parameters
key Any!: key whose mapping is to be removed from the map
name attribute name
Return
Any? the previous value of the attribute, or null if none
Exceptions
java.lang.UnsupportedOperationException if the remove operation is not supported by this map
java.lang.ClassCastException if the key is of an inappropriate type for this map (optional)
java.lang.NullPointerException if the specified key is null and this map does not permit null keys (optional)

Properties

entries

Added in API level 1
open val entries: MutableSet<MutableEntry<Any!, Any!>>

Returns a Collection view of the attribute name-value mappings contained in this Map.

Return
MutableSet<MutableEntry<Any!, Any!>> a set view of the mappings contained in this map

keys

Added in API level 1
open val keys: MutableSet<Any!>

Returns a Set view of the attribute names (keys) contained in this Map.

Return
MutableSet<Any!> a set view of the keys contained in this map

map

Added in API level 1
protected var map: MutableMap<Any!, Any!>!

The attribute name-value mappings.

size

Added in API level 1
open val size: Int

Returns the number of attributes in this Map.

Return
Int the number of key-value mappings in this map

values

Added in API level 1
open val values: MutableCollection<Any!>

Returns a Collection view of the attribute values contained in this Map.

Return
MutableCollection<Any!> a collection view of the values contained in this map