java.util.jar

Class 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
    • Field Detail

    • 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.
      • 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:

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

             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:

              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 - 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(), HashMap
      • 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
        Returns:
        a clone of this instance.
        See Also:
        Cloneable

Nederlandse vertaling

U hebt gevraagd om deze site in het Nederlands te bezoeken. Voor nu wordt alleen de interface vertaald, maar nog niet alle inhoud.

Als je me wilt helpen met vertalingen, is je bijdrage welkom. Het enige dat u hoeft te doen, is u op de site registreren en mij een bericht sturen waarin u wordt gevraagd om u toe te voegen aan de groep vertalers, zodat u de gewenste pagina's kunt vertalen. Een link onderaan elke vertaalde pagina geeft aan dat u de vertaler bent en heeft een link naar uw profiel.

Bij voorbaat dank.

Document heeft de 11/06/2005 gemaakt, de laatste keer de 04/03/2020 gewijzigd
Bron van het afgedrukte document:https://www.gaudry.be/nl/java-api-rf-java/util/jar/attributes.html

De infobrol is een persoonlijke site waarvan de inhoud uitsluitend mijn verantwoordelijkheid is. De tekst is beschikbaar onder CreativeCommons-licentie (BY-NC-SA). Meer info op de gebruiksvoorwaarden en de auteur.

Referenties

  1. Bekijk - html-document Taal van het document:fr Manuel PHP : https://docs.oracle.com

Deze verwijzingen en links verwijzen naar documenten die geraadpleegd zijn tijdens het schrijven van deze pagina, of die aanvullende informatie kunnen geven, maar de auteurs van deze bronnen kunnen niet verantwoordelijk worden gehouden voor de inhoud van deze pagina.
De auteur Deze site is als enige verantwoordelijk voor de manier waarop de verschillende concepten, en de vrijheden die met de referentiewerken worden genomen, hier worden gepresenteerd. Vergeet niet dat u meerdere broninformatie moet doorgeven om het risico op fouten te verkleinen.

Inhoudsopgave Haut