Modifier and Type | Field and Description |
---|---|
protected String | |
private static final boolean | |
protected String | encodedPersonal
The RFC 2047 encoded version of the personal name. |
private static final boolean | |
protected String | personal
The personal name. |
private static final String | |
private static final long | |
private static final String | |
private static final String | |
private static final boolean |
Access | Constructor and Description |
---|---|
public | |
public | |
public | InternetAddress(String
the address in RFC822 format address, boolean enforce RFC822 syntax strict)Parse the given string and create an InternetAddress. |
public | InternetAddress(String
the address in RFC822 format address, String the personal name personal)Construct an InternetAddress given the address and personal name. |
public | InternetAddress(String
the address in RFC822 format address, String the personal name personal, String the MIME charset for the name charset)Construct an InternetAddress given the address and personal name. |
Modifier and Type | Method and Description |
---|---|
pack-priv static InternetAddress | _getLocalAddress(Session session)
A package-private version of getLocalAddress that doesn't swallow the exception. |
private static void | checkAddress(String addr, boolean routeAddr, boolean validate)
Check that the address is a valid "mailbox" per RFC822. |
public Object | |
public boolean | equals(Object
Address object a)Implements abstract jakarta. |
public String | |
public InternetAddress[] | Returns: array of InternetAddress objects, or nulluse strict RFC 822 rules? strict)Return the members of a group address. |
public static InternetAddress | Returns: current user's email addressSession object used for property lookup session)Return an InternetAddress object representing the current user. |
private static String | getLocalHostName()
Get the local host name from InetAddress and return it in a form suitable for use in an email address. |
public String | |
public String | |
public int | |
private static int | indexOfAny(String s, String any)
Return the first index of any of the characters in "any" in "s", or -1 if none are found. |
private static int | |
public boolean | Returns: true if this address represents a groupIndicates whether this address is an RFC 822 group address. |
private static boolean | isInetAddressLiteral(String addr)
Is the address an IPv4 or IPv6 address literal, which needs to be enclosed in "[]" in an email address? |
private boolean | |
private static int | |
private static int | |
public static InternetAddress[] | |
public static InternetAddress[] | |
private static InternetAddress[] | |
public static InternetAddress[] | Returns: array of InternetAddress objectscomma separated address strings addresslist, boolean enforce RFC822 syntax strict)Parse the given sequence of addresses into InternetAddress objects. |
private static String | |
public void | |
public void | setPersonal(String
personal name name, String MIME charset to be used to encode the name as
per RFC 2047 charset)Set the personal name. |
public void | |
public String | Returns: possibly encoded address stringImplements abstract jakarta. |
public static String | |
public static String | Returns: comma separated string of addressesarray of InternetAddress objects addresses, int number of character positions already used, in
the field into which the address string is to
be inserted. used)Convert the given array of InternetAddress objects into a comma separated sequence of address strings. |
public String | Returns: Unicode address stringReturns a properly formatted address (RFC 822 syntax) of Unicode characters. |
public static String | Returns: comma separated string of addressesarray of InternetAddress objects addresses)Convert the given array of InternetAddress objects into a comma separated sequence of address strings. |
public static String | Returns: comma separated string of addressesarray of InternetAddress objects addresses, int number of character positions already used, in
the field into which the address string is to
be inserted. used)Convert the given array of InternetAddress objects into a comma separated sequence of address strings. |
private static String | |
public void |
address | back to summary |
---|---|
protected String address |
allowUtf8 | back to summary |
---|---|
private static final boolean allowUtf8 |
encodedPersonal | back to summary |
---|---|
protected String encodedPersonal The RFC 2047 encoded version of the personal name.
This field and the |
ignoreBogusGroupName | back to summary |
---|---|
private static final boolean ignoreBogusGroupName |
personal | back to summary |
---|---|
protected String personal The personal name. |
rfc822phrase | back to summary |
---|---|
private static final String rfc822phrase |
serialVersionUID | back to summary |
---|---|
private static final long serialVersionUID |
specialsNoDot | back to summary |
---|---|
private static final String specialsNoDot |
specialsNoDotNoAt | back to summary |
---|---|
private static final String specialsNoDotNoAt |
useCanonicalHostName | back to summary |
---|---|
private static final boolean useCanonicalHostName |
InternetAddress | back to summary |
---|---|
public InternetAddress() Default constructor. |
InternetAddress | back to summary |
---|---|
public InternetAddress(String address) throws AddressException Constructor.
Parse the given string and create an InternetAddress.
See the
|
InternetAddress | back to summary |
---|---|
public InternetAddress(String address, boolean strict) throws AddressException Parse the given string and create an InternetAddress.
If
|
InternetAddress | back to summary |
---|---|
public InternetAddress(String address, String personal) throws UnsupportedEncodingException Construct an InternetAddress given the address and personal name. The address is assumed to be a syntactically valid RFC822 address.
|
InternetAddress | back to summary |
---|---|
public InternetAddress(String address, String personal, String charset) throws UnsupportedEncodingException Construct an InternetAddress given the address and personal name. The address is assumed to be a syntactically valid RFC822 address.
|
_getLocalAddress | back to summary |
---|---|
pack-priv static InternetAddress _getLocalAddress(Session session) throws SecurityException, AddressException, UnknownHostException A package-private version of getLocalAddress that doesn't swallow the exception. Used by MimeMessage.setFrom() to report the reason for the failure. |
checkAddress | back to summary |
---|---|
private static void checkAddress(String addr, boolean routeAddr, boolean validate) throws AddressException Check that the address is a valid "mailbox" per RFC822. (We also allow simple names.) XXX - much more to check XXX - doesn't handle domain-literals properly (but no one uses them) |
clone | back to summary |
---|---|
public Object clone() Overrides java. Return a copy of this InternetAddress object.
|
equals | back to summary |
---|---|
public boolean equals(Object a) Implements abstract jakarta. The equality operator.
|
getAddress | back to summary |
---|---|
public String getAddress() Get the email address.
|
getGroup | back to summary |
---|---|
public InternetAddress[] getGroup(boolean strict) throws AddressException Return the members of a group address. A group may have zero,
one, or more members. If this address is not a group, null
is returned. The
|
getLocalAddress | back to summary |
---|---|
public static InternetAddress getLocalAddress(Session session) Return an InternetAddress object representing the current user.
The entire email address may be specified in the "mail.from"
property. If not set, the "mail.user" and "mail.host" properties
are tried. If those are not set, the "user.name" property and
|
getLocalHostName | back to summary |
---|---|
private static String getLocalHostName() throws UnknownHostException Get the local host name from InetAddress and return it in a form suitable for use in an email address. |
getPersonal | back to summary |
---|---|
public String getPersonal() Get the personal name. If the name is encoded as per RFC 2047, it is decoded and converted into Unicode. If the decoding or conversion fails, the raw data is returned as is.
|
getType | back to summary |
---|---|
public String getType() Implements abstract jakarta. Return the type of this address. The type of an InternetAddress is "rfc822".
|
hashCode | back to summary |
---|---|
public int hashCode() Overrides java. Compute a hash code for the address.
|
indexOfAny | back to summary |
---|---|
private static int indexOfAny(String s, String any) Return the first index of any of the characters in "any" in "s", or -1 if none are found. This should be a method on String. |
indexOfAny | back to summary |
---|---|
private static int indexOfAny(String s, String any, int start) |
isGroup | back to summary |
---|---|
public boolean isGroup() Indicates whether this address is an RFC 822 group address. Note that a group address is different than the mailing list addresses supported by most mail servers. Group addresses are rarely used; see RFC 822 for details.
|
isInetAddressLiteral | back to summary |
---|---|
private static boolean isInetAddressLiteral(String addr) Is the address an IPv4 or IPv6 address literal, which needs to be enclosed in "[]" in an email address? IPv4 literals contain decimal digits and dots, IPv6 literals contain hex digits, dots, and colons. We're lazy and don't check the exact syntax, just the allowed characters; strings that have only the allowed characters in a literal but don't meet the syntax requirements for a literal definitely can't be a host name and thus will fail later when used as an address literal. |
isSimple | back to summary |
---|---|
private boolean isSimple() Is this a "simple" address? Simple addresses don't contain quotes or any RFC822 special characters other than '@' and '.'. |
lengthOfFirstSegment | back to summary |
---|---|
private static int lengthOfFirstSegment(String s) |
lengthOfLastSegment | back to summary |
---|---|
private static int lengthOfLastSegment(String s, int used) |
parse | back to summary |
---|---|
public static InternetAddress[] parse(String addresslist) throws AddressException Parse the given comma separated sequence of addresses into InternetAddress objects. Addresses must follow RFC822 syntax.
|
parse | back to summary |
---|---|
public static InternetAddress[] parse(String addresslist, boolean strict) throws AddressException Parse the given sequence of addresses into InternetAddress
objects. If 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.
|
parse | back to summary |
---|---|
private static InternetAddress[] parse(String s, boolean strict, boolean parseHdr) throws AddressException
|
parseHeader | back to summary |
---|---|
public static InternetAddress[] parseHeader(String addresslist, boolean strict) throws AddressException Parse the given sequence of addresses into InternetAddress
objects. If
To better support the range of "invalid" addresses seen in real
messages, this method enforces fewer syntax rules than the
|
quotePhrase | back to summary |
---|---|
private static String quotePhrase(String phrase) |
setAddress | back to summary |
---|---|
public void setAddress(String address) Set the email address.
|
setPersonal | back to summary |
---|---|
public void setPersonal(String name, String charset) throws UnsupportedEncodingException Set the personal name. If the name contains non US-ASCII characters, then the name will be encoded using the specified charset as per RFC 2047. If the name contains only US-ASCII characters, no encoding is done and the name is used as is.
|
setPersonal | back to summary |
---|---|
public void setPersonal(String name) throws UnsupportedEncodingException Set the personal name. If the name contains non US-ASCII characters, then the name will be encoded using the platform's default charset. If the name contains only US-ASCII characters, no encoding is done and the name is used as is.
|
toString | back to summary |
---|---|
public String toString() Implements abstract jakarta. Convert this address into a RFC 822 / RFC 2047 encoded address. The resulting string contains only US-ASCII characters, and hence is mail-safe. |
toString | back to summary |
---|---|
public static String toString(Address[] addresses) Convert the given array of InternetAddress objects into a comma separated sequence of address strings. The resulting string contains only US-ASCII characters, and hence is mail-safe.
|
toString | back to summary |
---|---|
public static String toString(Address[] addresses, int used) Convert the given array of InternetAddress objects into a comma separated sequence of address strings. The resulting string contains only US-ASCII characters, and hence is mail-safe. 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.
|
toUnicodeString | back to summary |
---|---|
public String toUnicodeString() Returns a properly formatted address (RFC 822 syntax) of Unicode characters.
|
toUnicodeString | back to summary |
---|---|
public static String toUnicodeString(Address[] addresses) Convert the given array of InternetAddress objects into a comma separated sequence of address strings. The resulting string contains Unicode characters.
|
toUnicodeString | back to summary |
---|---|
public static String toUnicodeString(Address[] addresses, int used) Convert the given array of InternetAddress objects into a comma separated sequence of address strings. The resulting string contains Unicode characters. 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.
|
unquote | back to summary |
---|---|
private static String unquote(String s) |
validate | back to summary |
---|---|
public void validate() throws AddressException Validate that this address conforms to the syntax rules of RFC 822. The current implementation checks many, but not all, syntax rules. Note that even though the syntax of the address may be correct, there's no guarantee that a mailbox of that name exists.
|