javax.mail.internet

Class ParameterList


  • public class ParameterList
    extends Object
    This class holds MIME parameters (attribute-value pairs). The mail.mime.encodeparameters and mail.mime.decodeparameters System properties control whether encoded parameters, as specified by RFC 2231, are supported. By default, such encoded parameters are supported.

    Also, in the current implementation, setting the System property mail.mime.decodeparameters.strict to "true" will cause a ParseException to be thrown for errors detected while decoding encoded parameters. By default, if any decoding errors occur, the original (undecoded) string is used.

    The current implementation supports the System property mail.mime.parameters.strict, which if set to false when parsing a parameter list allows parameter values to contain whitespace and other special characters without being quoted; the parameter value ends at the next semicolon. If set to true (the default), parameter values are required to conform to the MIME specification and must be quoted if they contain whitespace or special characters.

    Author:
    John Mani, Bill Shannon
    • Constructor Detail

      • ParameterList

        public ParameterList()
        No-arg Constructor.
      • ParameterList

        public ParameterList(String s)
                      throws ParseException
        Constructor that takes a parameter-list string. The String is parsed and the parameters are collected and stored internally. A ParseException is thrown if the parse fails. Note that an empty parameter-list string is valid and will be parsed into an empty ParameterList.
        Parameters:
        s - the parameter-list string.
        Throws:
        ParseException - if the parse fails.
    • Method Detail

      • combineSegments

        public void combineSegments()
        Normal users of this class will use simple parameter names. In some cases, for example, when processing IMAP protocol messages, individual segments of a multi-segment name (specified by RFC 2231) will be encountered and passed to the set(java.lang.String, java.lang.String) method. After all these segments are added to this ParameterList, they need to be combined to represent the logical parameter name and value. This method will combine all segments of multi-segment names.

        Normal users should never need to call this method.

        Since:
        JavaMail 1.5
      • size

        public int size()
        Return the number of parameters in this list.
        Returns:
        number of parameters.
      • get

        public String get(String name)
        Returns the value of the specified parameter. Note that parameter names are case-insensitive.
        Parameters:
        name - parameter name.
        Returns:
        Value of the parameter. Returns null if the parameter is not present.
      • set

        public void set(String name,
                        String value)
        Set a parameter. If this parameter already exists, it is replaced by this new value.
        Parameters:
        name - name of the parameter.
        value - value of the parameter.
      • set

        public void set(String name,
                        String value,
                        String charset)
        Set a parameter. If this parameter already exists, it is replaced by this new value. If the mail.mime.encodeparameters System property is true, and the parameter value is non-ASCII, it will be encoded with the specified charset, as specified by RFC 2231.
        Parameters:
        name - name of the parameter.
        value - value of the parameter.
        charset - charset of the parameter value.
        Since:
        JavaMail 1.4
      • remove

        public void remove(String name)
        Removes the specified parameter from this ParameterList. This method does nothing if the parameter is not present.
        Parameters:
        name - name of the parameter.
      • getNames

        public Enumeration getNames()
        Return an enumeration of the names of all parameters in this list.
        Returns:
        Enumeration of all parameter names in this list.
      • toString

        public String toString()
        Convert this ParameterList into a MIME String. If this is an empty list, an empty string is returned.
        Overrides:
        toString in class Object
        Returns:
        String
      • toString

        public String toString(int used)
        Convert this ParameterList into a MIME String. If this is an empty list, an empty string is returned. The 'used' parameter specifies the number of character positions already taken up in the field into which the resulting parameter list is to be inserted. It's used to determine where to fold the resulting parameter list.
        Parameters:
        used - number of character positions already used, in the field into which the parameter list is to be inserted.
        Returns:
        String

Traduction non disponible

Les API Java ne sont pas encore traduites en français sur l'infobrol. Seule la version anglaise est disponible pour l'instant.

Version en cache

21/08/2025 19:05:27 Cette version de la page est en cache (à la date du 21/08/2025 19:05:27) afin d'accélérer le traitement.
Vous pouvez activer le mode utilisateur dans le menu en haut pour afficher la version plus récente de la page.

Document créé le 19/04/2008, dernière modification le 18/08/2025
Source du document imprimé : https://www.gaudry.be/java-api-javaee-rf-javax/mail/internet/parameterlist.html

L'infobrol est un site personnel dont le contenu n'engage que moi. Le texte est mis à disposition sous licence CreativeCommons(BY-NC-SA). Plus d'info sur les conditions d'utilisation et sur l'auteur.

Références

  1. Consulter le document html Langue du document :fr Manuel PHP : https://docs.oracle.com, ParameterList

Ces références et liens indiquent des documents consultés lors de la rédaction de cette page, ou qui peuvent apporter un complément d'information, mais les auteurs de ces sources ne peuvent être tenus responsables du contenu de cette page.
L'auteur de ce site est seul responsable de la manière dont sont présentés ici les différents concepts, et des libertés qui sont prises avec les ouvrages de référence. N'oubliez pas que vous devez croiser les informations de sources multiples afin de diminuer les risques d'erreurs.