Methods Summary |
---|
public java.lang.String | getBody()Retrieve the body line from the parsed mailto URL.
If no body line was specified, then null is return
return mHeaders.get(BODY);
|
public java.lang.String | getCc()Retrieve the CC address line from the parsed mailto URL. This could be
several email address that are comma-space delimited.
If no CC line was specified, then null is return
return mHeaders.get(CC);
|
public java.util.Map | getHeaders()Retrieve all the parsed email headers from the mailto URL
return mHeaders;
|
public java.lang.String | getSubject()Retrieve the subject line from the parsed mailto URL.
If no subject line was specified, then null is return
return mHeaders.get(SUBJECT);
|
public java.lang.String | getTo()Retrieve the To address line from the parsed mailto URL. This could be
several email address that are comma-space delimited.
If no To line was specified, then null is return
return mHeaders.get(TO);
|
public static boolean | isMailTo(java.lang.String url)Test to see if the given string is a mailto URL
if (url != null && url.startsWith(MAILTO_SCHEME)) {
return true;
}
return false;
|
public static android.net.MailTo | parse(java.lang.String url)Parse and decode a mailto scheme string. This parser implements
RFC 2368. The returned object can be queried for the parsed parameters.
if (url == null) {
throw new NullPointerException();
}
if (!isMailTo(url)) {
throw new ParseException("Not a mailto scheme");
}
// Strip the scheme as the Uri parser can't cope with it.
String noScheme = url.substring(MAILTO_SCHEME.length());
Uri email = Uri.parse(noScheme);
MailTo m = new MailTo();
// Parse out the query parameters
String query = email.getQuery();
if (query != null ) {
String[] queries = query.split("&");
for (String q : queries) {
String[] nameval = q.split("=");
if (nameval.length == 0) {
continue;
}
// insert the headers with the name in lowercase so that
// we can easily find common headers
m.mHeaders.put(Uri.decode(nameval[0]).toLowerCase(Locale.ROOT),
nameval.length > 1 ? Uri.decode(nameval[1]) : null);
}
}
// Address can be specified in both the headers and just after the
// mailto line. Join the two together.
String address = email.getPath();
if (address != null) {
String addr = m.getTo();
if (addr != null) {
address += ", " + addr;
}
m.mHeaders.put(TO, address);
}
return m;
|
public java.lang.String | toString()
StringBuilder sb = new StringBuilder(MAILTO_SCHEME);
sb.append('?");
for (Map.Entry<String,String> header : mHeaders.entrySet()) {
sb.append(Uri.encode(header.getKey()));
sb.append('=");
sb.append(Uri.encode(header.getValue()));
sb.append('&");
}
return sb.toString();
|