java.lang.Object | +--javax.mail.Address | +--javax.mail.internet.InternetAddressAll Implemented Interfaces:
String | The string form of the address. |
String | The RFC 2047 encoded version of the personal name. |
String | The personal name. |
Default constructor. |
InternetAddress(String address) Parse the given string and create an InternetAddress. |
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. |
Object | clone() Return a copy of this InternetAddress object. |
boolean | equals(Object other) The equality operator. |
String | Get the email address. |
getGroup(boolean strict) Return the members of a group address. | |
static InternetAddress | getLocalAddress(Session session) Return an InternetAddress object representing the current user. |
String | Get the personal name. |
String | getType() Return the type of this address. |
int | hashCode() Compute a hash code for the address. |
boolean | isGroup() 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. |
void | setAddress(String address) Set the email address. |
void | setPersonal(String name, String charset) Set the personal name. |
void | setPersonal(String name) Set the personal name. |
String | toString() Convert this address into a RFC 822 / RFC 2047 encoded address. |
static String | Convert the given array of InternetAddress objects into a comma separated sequence of address strings. |
static String | toString(Address[] addresses, int used) Convert the given array of InternetAddress objects into a comma separated sequence of address strings. |
String | Returns a properly formatted address (RFC 822 syntax) of Unicode characters. |
void | validate() Validate that this address conforms to the syntax rules of RFC 822. |
protected String address
protected String encodedPersonal
protected String personal
public InternetAddress()
public InternetAddress(String address)
AddressException
- if the parse failedpublic InternetAddress(String address, String personal)
public InternetAddress(String address, String personal, String charset)
public InternetAddress(String address, boolean strict)
strict
is false, the detailed syntax of the address
isn't checked.
AddressException
- if the parse failedpublic Object clone()
public boolean equals(Object other)
public String getAddress()
public InternetAddress[] getGroup(boolean strict)
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 parsedpublic static InternetAddress getLocalAddress(Session session)
public String getPersonal()
public String getType()
public int hashCode()
public boolean isGroup()
public static InternetAddress[] parse(String addresslist)
AddressException
- if the parse failedpublic static InternetAddress[] parse(String addresslist, boolean strict)
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.
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.
AddressException
- if the parse failedpublic static InternetAddress[] parseHeader(String addresslist, boolean strict)
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.
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.
public void setAddress(String address)
public void setPersonal(String name)
- - if the charset encoding fails.public void setPersonal(String name, String charset)
public String toString()
public static String toString(Address[] addresses)
- if any address object in the given array
is not an InternetAddress objects.public static String toString(Address[] addresses, int used)
- if any address object in the given array
is not an InternetAddress object.public String toUnicodeString()
public void validate()
AddressException
- if the address isn't valid