java.lang.Objectjavax.mail.Address
javax.mail.internet.InternetAddress
This class represents an Internet email address using the syntax
of RFC822.
Typical address syntax is of the form "user@host.domain" or
"Personal Name
This field and the
Parse the given string and create an InternetAddress.
See the
The 'used' parameter specifies the number of character positions
already taken up in the field into which the resulting address
sequence string is to be inserted. It is used to determine the
line-break positions in the resulting address sequence string.
Non-strict parsing is typically used when parsing a list of
mail addresses entered by a human. Strict parsing is typically
used when parsing address headers in mail messages.
To better support the range of "invalid" addresses seen in real
messages, this method enforces fewer syntax rules than the
Field Summary
protected Stringaddress
protected StringencodedPersonal
The RFC 2047 encoded version of the personal name.
protected Stringpersonal
The personal name.
Constructor Summary
InternetAddress()
Default constructor.
InternetAddress(String address)
Constructor.
InternetAddress(String address,
boolean strict)
Parse the given string and create an InternetAddress.
InternetAddress(String address,
String personal)
Construct an InternetAddress given the address and personal name.
InternetAddress(String address,
String personal,
String charset)
Construct an InternetAddress given the address and personal name.
Method Summary
Objectclone()
Return a copy of this InternetAddress object.
booleanequals(Object a)
The equality operator.
StringgetAddress()
Get the email address.
InternetAddress[]getGroup(boolean strict)
Return the members of a group address.
static InternetAddressgetLocalAddress(Session session)
Return an InternetAddress object representing the current user.
StringgetPersonal()
Get the personal name.
StringgetType()
Return the type of this address.
inthashCode()
Compute a hash code for the address.
booleanisGroup()
Indicates whether this address is an RFC 822 group address.
static InternetAddress[]parse(String addresslist)
Parse the given comma separated sequence of addresses into
InternetAddress objects.
static InternetAddress[]parse(String addresslist,
boolean strict)
Parse the given sequence of addresses into InternetAddress
objects.
static InternetAddress[]parseHeader(String addresslist,
boolean strict)
Parse the given sequence of addresses into InternetAddress
objects.
voidsetAddress(String address)
Set the email address.
voidsetPersonal(String name)
Set the personal name.
voidsetPersonal(String name,
String charset)
Set the personal name.
StringtoString()
Convert this address into a RFC 822 / RFC 2047 encoded address.
static StringtoString(Address[] addresses)
Convert the given array of InternetAddress objects into
a comma separated sequence of address strings.
static StringtoString(Address[] addresses,
int used)
Convert the given array of InternetAddress objects into
a comma separated sequence of address strings.
StringtoUnicodeString()
Returns a properly formatted address (RFC 822 syntax) of
Unicode characters.
voidvalidate()
Validate that this address conforms to the syntax rules of
RFC 822.
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Field Detail
address
protected String address
personal
protected String personal
encodedPersonal
protected String encodedPersonal
personal field track each
other, so if a subclass sets one of these fields directly, it
should set the other to null, so that it is
suitably recomputed.
Constructor Detail
InternetAddress
public InternetAddress()
InternetAddress
public InternetAddress(String address)
throws AddressException
parse method for details of the parsing.
The address is parsed using "strict" parsing.
This constructor does not perform the additional
syntax checks that the
InternetAddress(String address, boolean strict)
constructor does when strict is true.
This constructor is equivalent to
InternetAddress(address, false).
address - the address in RFC822 format
AddressException - if the parse failed
InternetAddress
public InternetAddress(String address,
boolean strict)
throws AddressException
strict is false, the detailed syntax of the
address isn't checked.
address - the address in RFC822 formatstrict - enforce RFC822 syntax
AddressException - if the parse failed
InternetAddress
public InternetAddress(String address,
String personal)
throws UnsupportedEncodingException
address - the address in RFC822 formatpersonal - the personal name
UnsupportedEncodingException
InternetAddress
public InternetAddress(String address,
String personal,
String charset)
throws UnsupportedEncodingException
address - the address in RFC822 formatpersonal - the personal namecharset - the MIME charset for the name
UnsupportedEncodingException
Method Detail
clone
public Object clone()
getType
public String getType()
InternetAddress
setAddress
public void setAddress(String address)
address - email address
setPersonal
public void setPersonal(String name,
String charset)
throws UnsupportedEncodingException
name - personal namecharset - MIME charset to be used to encode the name as
per RFC 2047
UnsupportedEncodingException - if the charset encoding
fails.setPersonal(String)
setPersonal
public void setPersonal(String name)
throws UnsupportedEncodingException
name - personal name
UnsupportedEncodingException - if the charset encoding
fails.setPersonal(String name, String charset)
getAddress
public String getAddress()
getPersonal
public String getPersonal()
toString
public String toString()
toUnicodeString
public String toUnicodeString()
equals
public boolean equals(Object a)
hashCode
public int hashCode()
toString
public static String toString(Address[] addresses)
addresses - array of InternetAddress objects
ClassCastException, - if any address object in the
given array is not an InternetAddress object. Note
that this is a RuntimeException.
toString
public static String toString(Address[] addresses,
int used)
addresses - array of InternetAddress objectsused - number of character positions already used, in
the field into which the address string is to
be inserted.
ClassCastException, - if any address object in the
given array is not an InternetAddress object. Note
that this is a RuntimeException.
getLocalAddress
public static InternetAddress getLocalAddress(Session session)
InetAddress.getLocalHost method are tried.
Security exceptions that may occur while accessing this information
are ignored. If it is not possible to determine an email address,
null is returned.
session - Session object used for property lookup
parse
public static InternetAddress[] parse(String addresslist)
throws AddressException
addresslist - comma separated address strings
AddressException - if the parse failed
parse
public static InternetAddress[] parse(String addresslist,
boolean strict)
throws AddressException
strict is false, simple email addresses
separated by spaces are also allowed. If strict is
true, many (but not all) of the RFC822 syntax rules are enforced.
In particular, even if strict is true, addresses
composed of simple names (with no "@domain" part) are allowed.
Such "illegal" addresses are not uncommon in real messages.
addresslist - comma separated address stringsstrict - enforce RFC822 syntax
AddressException - if the parse failed
parseHeader
public static InternetAddress[] parseHeader(String addresslist,
boolean strict)
throws AddressException
strict is false, the full syntax rules for
individual addresses are not enforced. If strict is
true, many (but not all) of the RFC822 syntax rules are enforced. parse method when the strict flag is false
and enforces more rules when the strict flag is true. If the
strict flag is false and the parse is successful in separating out an
email address or addresses, the syntax of the addresses themselves
is not checked.
addresslist - comma separated address stringsstrict - enforce RFC822 syntax
AddressException - if the parse failed
validate
public void validate()
throws AddressException
AddressException - if the address isn't valid.
isGroup
public boolean isGroup()
getGroup
public InternetAddress[] getGroup(boolean strict)
throws AddressException
strict parameter controls whether
the group list is parsed using strict RFC 822 rules or not.
The parsing is done using the parseHeader method.
AddressException - if the group list can't be parsed
Ces informations proviennent du site de http://java.sun.com
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 :
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.
Vous pouvez modifier vos préférences dans votre profil pour ne plus afficher les interactions avec les réseaux sociaux sur ces pages.
8 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.
Recherche (afficher)
Utilisateur (masquer)
Navigation (masquer)
Apparence (afficher)
Stats (afficher)
Citation (masquer)