API java : Attributes


java.util.jar
Class Attributes

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

public class Attributes
extends Object
implements Map<Object,Object>, 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

Nested Class Summary
static class Attributes.Name
          The Attributes.Name class represents an attribute name stored in this Map.
 
Nested classes/interfaces inherited from interface java.util.Map
Map.Entry<K,V>
 
Field Summary
protected  Map<Object,Object> map
          The attribute name-value mappings.
 
Constructor Summary
Attributes()
          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<Map.Entry<Object,Object>> entrySet()
          Returns a Collection view of the attribute name-value mappings contained in this Map.
 boolean equals(Object o)
          Compares the specified Attributes object with this Map for equality.
 Object get(Object name)
          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 getValue(String name)
          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<Object> keySet()
          Returns a Set view of the attribute names (keys) contained in this Map.
 Object put(Object name, Object value)
          Associates the specified value with the specified attribute name (key) in this Map.
 void putAll(Map<?,?> attr)
          Copies all of the attribute name-value mappings from the specified Attributes to this Map.
 String putValue(String name, String value)
          Associates the specified value with the specified attribute name, specified as a String.
 Object remove(Object name)
          Removes the attribute with the specified name (key) from this Map.
 int size()
          Returns the number of attributes in this Map.
 Collection<Object> values()
          Returns a Collection view of the attribute values contained in this Map.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

map

protected Map<Object,Object> map
The attribute name-value mappings.

Constructor Detail

Attributes

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


Attributes

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

Parameters:
size - the initial number of attributes

Attributes

public Attributes(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

public Object get(Object name)
Returns the value of the specified attribute name, or null if the attribute name was not found.

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

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 defined as:

  1. return (String)get(new Attributes.Name.html">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 - if the attribute name is invalid

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 defined as:

  1. 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

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.

Specified by:
put in interface Map<Object,Object>
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 defined as:

  1. return (String)put(new Attributes.Name.html">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 - if the attribute name is invalid

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.

Specified by:
remove in interface Map<Object,Object>
Parameters:
name - attribute name
Returns:
the previous value of the attribute, or null if none

containsValue

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

Specified by:
containsValue in interface Map<Object,Object>
Parameters:
value - the attribute value
Returns:
true if this Map maps one or more attribute names to the specified value

containsKey

public boolean containsKey(Object name)
Returns true if this Map contains the specified attribute name (key).

Specified by:
containsKey in interface Map<Object,Object>
Parameters:
name - the attribute name
Returns:
true if this Map contains the specified attribute name

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.

Specified by:
putAll in interface Map<Object,Object>
Parameters:
attr - the Attributes to be stored in this map
Throws:
ClassCastException - if attr is not an Attributes

clear

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

Specified by:
clear in interface Map<Object,Object>

size

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

Specified by:
size in interface Map<Object,Object>
Returns:
the number of key-value mappings in this map.

isEmpty

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

Specified by:
isEmpty in interface Map<Object,Object>
Returns:
true if this map contains no key-value mappings.

keySet

public Set<Object> keySet()
Returns a Set view of the attribute names (keys) contained in this Map.

Specified by:
keySet in interface Map<Object,Object>
Returns:
a set view of the keys contained in this map.

values

public Collection<Object> values()
Returns a Collection view of the attribute values contained in this Map.

Specified by:
values in interface Map<Object,Object>
Returns:
a collection view of the values contained in this map.

entrySet

public Set<Map.Entry<Object,Object>> entrySet()
Returns a Collection view of the attribute name-value mappings contained in this Map.

Specified by:
entrySet in interface Map<Object,Object>
Returns:
a set view of the 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.

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

hashCode

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

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

clone

public Object clone()
Returns a copy of the Attributes, implemented as follows:
  1. 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
Returns:
a clone of this instance.
See Also:
Cloneable

Ces informations proviennent du site de http://java.sun.com

Remarques

Contenu

Le contenu de cette page provient du site de Sun, et est généré depuis un cache sur l'infobrol après certains traitements automatisés. La présentation peut donc différer du document original, mais le contenu aussi. Vous pouvez utiliser ce bouton pour afficher la page originale du site de Sun :

Quels sont les motivations de cette démarche?

Maintenir les pages en cache sur différents sites peut offrir plus de disponibilité.

Chaque page est indexée dans la base de donnée, ce qui permet de retrouver facilement les informations, au moyen des sommaires, du moteur de recherche interne, etc.

Des facilités sont mises en place pour que les membres de l'infobrol puissent effectuer des traductions en français des différents documents. Ceci devrait permettre aux débutants en programmation Java de consulter les API en français s'ils maîtrisent moins bien la langue de Shakespeare. Dans le cas où une traduction a été soumise, elle est disponible au moyen d'un lien en bas de page. Si la traduction a été validée, la page s'affiche par défaut en français, et un lien en bas de page permet d'atteindre la version en anglais.

Le code sur l'infobrol est automatiquement coloré selon la syntaxe, et les différents mots clés sont transformés en liens pour accéder rapidement aux informations.

Vous avez la possibilité de partager vos expériences en proposant vos propres extraits de code en utilisant le bouton "ajouter un commentaire" en bas de page. Si vous visitez simplement l'infobrol, vous avez déjà accès à cette fonction, mais si vous étes membre du brol, vous pouvez en plus utiliser des boutons supplémentaires de mise en forme, dont la coloration automatique de vos extraits de codes.

Réseaux sociaux

Vous pouvez modifier vos préférences dans votre profil pour ne plus afficher les interactions avec les réseaux sociaux sur ces pages.

 

Nuage de mots clés

7 mots clés dont 0 définis manuellement (plus d'information...).

Avertissement

Cette page ne possède pas encore de mots clés manuels, ceci est donc un exemple automatique (les niveaux de pertinence sont fictifs, mais les liens sont valables). Pour tester le nuage avec une page qui contient des mots définis manuellement, vous pouvez cliquer ici.

Vous pouvez modifier vos préférences dans votre profil pour ne plus afficher le nuage de mots clés.

 

Astuce pour imprimer les couleurs des cellules de tableaux : http://www.gaudry.be/ast-rf-450.html
Aucun commentaire pour cette page

© Ce document issu de l′infobrol est enregistré sous le certificat Cyber PrInterDeposit Digital Numbertection. Enregistrement IDDN n° 5329-1420
Document créé le 29/08/06 22:59, dernière modification le Vendredi 17 Juin 2011, 12:12
Source du document imprimé : http:///www.gaudry.be/java-api-rf-java/util/jar/Attributes.html
St.Gaudry©07.01.02
Outils (masquer)
||
Recherche (afficher)
Recherche :

Utilisateur (masquer)
Apparence (afficher)
Stats (afficher)
15838 documents
455 astuces.
550 niouzes.
3107 definitions.
447 membres.
8121 messages.

Document genere en :
0,32 seconde

Mises à jour :
Mises à jour du site
Citation (masquer)
Quand on reste immobile, la peur pousse mieux.

Daniel Picouly [Extrait de L'enfant léopard]
 
l'infobrol
Nous sommes le Mercredi 26 Juillet 2017, 06:34, toutes les heures sont au format GMT+1.00 Heure, heure d'été (+1)