|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.mail.Address
javax.mail.internet.InternetAddress
An RFC 822 address.
Field Summary | |
protected java.lang.String |
address
The string representation of the address. |
protected java.lang.String |
encodedPersonal
The RFC 2047 encoded version of the personal name. |
protected java.lang.String |
personal
The personal name. |
Constructor Summary | |
InternetAddress()
Constructor for an empty address. |
|
InternetAddress(java.lang.String address)
Constructor with an RFC 822 string representation of the address. |
|
InternetAddress(java.lang.String address,
boolean strict)
Constructor with an RFC 822 string representation of the address. |
|
InternetAddress(java.lang.String address,
java.lang.String personal)
Constructor with an address and personal name. |
|
InternetAddress(java.lang.String address,
java.lang.String personal,
java.lang.String charset)
Construct with an address and personal name. |
Method Summary | |
java.lang.Object |
clone()
Returns a copy of this address. |
boolean |
equals(java.lang.Object other)
|
java.lang.String |
getAddress()
Returns the email address. |
InternetAddress[] |
getGroup(boolean strict)
Returns the members of a group address. |
static InternetAddress |
getLocalAddress(Session session)
Returns an InternetAddress object representing the current user. |
java.lang.String |
getPersonal()
Returns the personal name. |
java.lang.String |
getType()
Returns the type of this address. |
int |
hashCode()
|
boolean |
isGroup()
Indicates whether this address is an RFC 822 group address. |
static InternetAddress[] |
parse(java.lang.String addresslist)
Parses the given comma-separated sequence of RFC 822 addresses into InternetAddresses. |
static InternetAddress[] |
parse(java.lang.String addresslist,
boolean strict)
Parses the given comma-separated sequence of RFC 822 addresses into InternetAddresses. |
static InternetAddress[] |
parseHeader(java.lang.String addresslist,
boolean strict)
Parses the given comma-separated sequence of RFC 822 addresses into InternetAddresses. |
void |
setAddress(java.lang.String address)
Sets the email address. |
void |
setPersonal(java.lang.String name)
Sets the personal name. |
void |
setPersonal(java.lang.String name,
java.lang.String charset)
Sets the personal name. |
java.lang.String |
toString()
Returns the RFC 822 / RFC 2047 string representation of this address. |
static java.lang.String |
toString(Address[] addresses)
Converts the given array of InternetAddresses into a comma-separated sequence of address strings. |
static java.lang.String |
toString(Address[] addresses,
int used)
Converts the given array of InternetAddresses into a comma-separated sequence of address strings. |
java.lang.String |
toUnicodeString()
Returns the RFC 822 string representation of this address. |
void |
validate()
Validate this address according to the syntax rules of RFC 822. |
Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
protected java.lang.String address
protected java.lang.String personal
protected java.lang.String encodedPersonal
Constructor Detail |
public InternetAddress()
public InternetAddress(java.lang.String address) throws AddressException
address
- the address in RFC 822 format
AddressException
- if the parse failedpublic InternetAddress(java.lang.String address, boolean strict) throws AddressException
address
- the address in RFC 822 formatstrict
- enforce RFC 822 syntax
AddressException
- if the parse failedpublic InternetAddress(java.lang.String address, java.lang.String personal) throws java.io.UnsupportedEncodingException
address
- the address in RFC 822 formatpersonal
- the personal namepublic InternetAddress(java.lang.String address, java.lang.String personal, java.lang.String charset) throws java.io.UnsupportedEncodingException
address
- the address in RFC 822 formatpersonal
- the personal namecharset
- the charset for the personal nameMethod Detail |
public java.lang.Object clone()
public java.lang.String getType()
InternetAddress
is "rfc822".
getType
in class Address
public boolean isGroup()
public InternetAddress[] getGroup(boolean strict) throws AddressException
null
.
AddressException
- if a parse error occurspublic void setAddress(java.lang.String address)
public void setPersonal(java.lang.String name, java.lang.String charset) throws java.io.UnsupportedEncodingException
name
- the personal namecharset
- the charset to be used for any encoding
java.io.UnsupportedEncodingException
public void setPersonal(java.lang.String name) throws java.io.UnsupportedEncodingException
name
- the personal name
java.io.UnsupportedEncodingException
- if charset encoding failspublic java.lang.String getAddress()
public java.lang.String getPersonal()
public void validate() throws AddressException
AddressException
- if the address is invalidpublic java.lang.String toString()
toString
in class Address
public java.lang.String toUnicodeString()
public boolean equals(java.lang.Object other)
equals
in class Address
public int hashCode()
public static java.lang.String toString(Address[] addresses)
addresses
- the InternetAddresses
java.lang.ClassCastException
- if any of the specified addresses is not
an InternetAddresspublic static java.lang.String toString(Address[] addresses, int used)
addresses
- the InternetAddressesused
- the number of character positions already used, in the
field into which the address string is to be inserted
java.lang.ClassCastException
- if any of the specified addresses is not
an InternetAddresspublic static InternetAddress getLocalAddress(Session session)
mail.from
mail.user
or
user.name
, and mail.host
user.name
and the hostname of
localhost as determined by InetAddress.getLocalHost
session
- the sessionpublic static InternetAddress[] parse(java.lang.String addresslist) throws AddressException
addresslist
- the comma-separated addresses
AddressException
- if the parse failedpublic static InternetAddress[] parse(java.lang.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 RFC 822 syntax rules are enforced.
Even if strict
is true, addresses composed of simple
names (with no "@domain" part) are allowed.
addresslist
- the comma-separated addressesstrict
- whether to enforce RFC 822 syntax
AddressException
- if the parse failedpublic static InternetAddress[] parseHeader(java.lang.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 RFC 822 syntax rules are enforced.
addresslist
- the comma-separated addressesstrict
- whether to enforce RFC 822 syntax
AddressException
- if the parse failed
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |