|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.mail.Address javax.mail.internet.InternetAddress
public class InternetAddress
A representation of an Internet email address as specified by RFC822 in conjunction with a human-readable personal name that can be encoded as specified by RFC2047. A typical address is "user@host.domain" and personal name "Joe User"
Field Summary | |
---|---|
protected String |
address
The address in RFC822 format. |
protected String |
encodedPersonal
The personal name in RFC2047 format. |
protected String |
personal
The personal name as a Java String. |
Constructor Summary | |
---|---|
InternetAddress()
|
|
InternetAddress(String address)
|
|
InternetAddress(String address,
boolean strict)
|
|
InternetAddress(String address,
String personal)
|
|
InternetAddress(String address,
String personal,
String charset)
|
Method Summary | |
---|---|
Object |
clone()
Clone this object. |
boolean |
equals(Object o)
Compares two addresses for equality. |
String |
getAddress()
Return the address. |
InternetAddress[] |
getGroup(boolean strict)
Return the members of a group address. |
static InternetAddress |
getLocalAddress(Session session)
Return an InternetAddress representing the current user. |
String |
getPersonal()
Return the personal name. |
String |
getType()
Return the type of this address. |
int |
hashCode()
Return the hashCode for this address. |
boolean |
isGroup()
Return true is this address is an RFC822 group address in the format phrase ":" [#mailbox] ";" . |
static InternetAddress[] |
parse(String addresses)
Parse addresses out of the string with basic checking. |
static InternetAddress[] |
parse(String addresses,
boolean strict)
Parse addresses out of the string. |
static InternetAddress[] |
parseHeader(String addresses,
boolean strict)
Parse addresses out of the string. |
void |
setAddress(String address)
Set the address. |
void |
setPersonal(String name)
Set the personal name. |
void |
setPersonal(String name,
String charset)
Set the personal name. |
String |
toString()
Return a string representation of this address using only US-ASCII characters. |
static String |
toString(Address[] addresses)
Convert the supplied addresses into a single String of comma-separated text as produced by toString() . |
static String |
toString(Address[] addresses,
int used)
Convert the supplies addresses into a String of comma-separated text, inserting line-breaks between addresses as needed to restrict the line length to 72 characters. |
String |
toUnicodeString()
Return a string representation of this address using Unicode characters. |
void |
validate()
Validate the address portion of an internet address to ensure validity. |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected String address
protected String encodedPersonal
protected String personal
Constructor Detail |
---|
public InternetAddress()
public InternetAddress(String address) throws AddressException
AddressException
public InternetAddress(String address, boolean strict) throws AddressException
AddressException
public InternetAddress(String address, String personal) throws UnsupportedEncodingException
UnsupportedEncodingException
public InternetAddress(String address, String personal, String charset) throws UnsupportedEncodingException
UnsupportedEncodingException
Method Detail |
---|
public Object clone()
clone
in class Object
public String getType()
getType
in class Address
public void setAddress(String address)
address
- the address to setpublic void setPersonal(String name, String charset) throws UnsupportedEncodingException
name
- the new personal namecharset
- the charset to use; see MimeUtilityencodeWord
UnsupportedEncodingException
- if the name cannot be encodedpublic void setPersonal(String name) throws UnsupportedEncodingException
MimeUtility.encodeWord(String)
; if this fails then an
UnsupportedEncodingException is thrown and no fields are modified.
name
- the new personal name
UnsupportedEncodingException
- if the name cannot be encodedpublic String getAddress()
public String getPersonal()
MimeUtility.decodeWord(String)
; if this is sucessful, then
the personal field is updated with that value and returned; if there is a problem
decoding the text then the raw value from encodedPersonal is returned.
public String toString()
toString
in class Address
public String toUnicodeString()
public boolean equals(Object o)
equals
in class Address
o
- the other object
public int hashCode()
hashCode
in class Object
public boolean isGroup()
phrase ":" [#mailbox] ";"
.
We check this by using the presense of a ':' character in the address, and a
';' as the very last character.
public InternetAddress[] getGroup(boolean strict) throws AddressException
strict
- whether strict RFC822 checking should be performed
AddressException
- if there was a problem parsing the headerpublic static InternetAddress getLocalAddress(Session session)
session
- used to obtain mail properties
public static String toString(Address[] addresses)
toString()
.
No line-break detection is performed.
addresses
- the array of addresses to convert
public static String toString(Address[] addresses, int used)
addresses
- the array of addresses to convertused
- the starting column
public static InternetAddress[] parse(String addresses) throws AddressException
addresses
- the addresses to parse
AddressException
- if addresses checking failspublic static InternetAddress[] parse(String addresses, boolean strict) throws AddressException
addresses
- the addresses to parsestrict
- if true perform detailed checking, if false just perform basic checking
AddressException
- if address checking failspublic static InternetAddress[] parseHeader(String addresses, boolean strict) throws AddressException
addresses
- the addresses to parsestrict
- if true perform detailed checking, if false perform little checking
AddressException
- if address checking failspublic void validate() throws AddressException
AddressException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |