@ThreadSafe public final class InternetAddressX extends Object
Modifier and Type | Field and Description |
---|---|
static Pattern |
VALID_PATTERN_BARE_DOMNAME
The pattern of valid email address consisting of the bare addr-spec having no
personal part and no angle braces, and with no domain literals (like
joe@[192.168.1.100] ). |
Modifier and Type | Method and Description |
---|---|
static String |
canonicalAddress(String address)
Converts an email address to canonical form.
|
static void |
canonicalize(InternetAddress iAddress)
Converts an email address to canonical form.
|
static String |
localPart(InternetAddress iAddress)
Returns the local-part of the address.
|
static String |
localPart(String addrSpec)
Returns the local-part of the address.
|
static String |
newValidAddress(String loc,
String dom)
Constructs an email address from a local-part and a domain name, and validates it.
|
static UnsupportedEncodingException |
trySetPersonal(InternetAddress iAddress,
String name)
Same as setPersonal(name),
but returns any UnsupportedEncodingException that occurs, rather than throwing it.
|
static UnsupportedEncodingException |
trySetPersonal(InternetAddress iAddress,
String name,
String charset)
Same as setPersonal(name,charset),
but returns any UnsupportedEncodingException that occurs, rather than throwing it.
|
public static final Pattern VALID_PATTERN_BARE_DOMNAME
joe@[192.168.1.100]
).AddressValidationP
public static String canonicalAddress(String address) throws AddressException
AddressException
canonicalize(InternetAddress)
,
VALID_PATTERN_BARE_DOMNAME
public static void canonicalize(InternetAddress iAddress)
canonicalAddress(String)
public static String localPart(InternetAddress iAddress) throws AddressException
iAddress
- a single (non-group) addressAddressException
- if the address is a group address,
or contains no local-partpublic static String localPart(String addrSpec) throws AddressException
addrSpec
- the bare addr-spec of an email address, having no
personal part and no angle bracesAddressException
- if addrSpec contains no local-partpublic static String newValidAddress(String loc, String dom) throws AddressException
loc
- the local-partdom
- the domain nameAddressException
- if loc or dom is null, or if the resulting address
cannot be validatedVALID_PATTERN_BARE_DOMNAME
public static UnsupportedEncodingException trySetPersonal(InternetAddress iAddress, String name)
public static UnsupportedEncodingException trySetPersonal(InternetAddress iAddress, String name, String charset)