Methods Summary |
---|
public java.lang.String | getDisplayName(java.lang.String rest)Gets the user friendly display name.
String retval = null;
int begin = rest.indexOf("(");
int end = rest.indexOf(")");
if (begin != -1 && end != -1 && end > begin) {
// p=+44-171-380-7777 (Mark Handley)
retval = rest.substring(begin+1, end);
} else {
// The alternative RFC822 name quoting convention is
// also allowed for
// email addresses. ex: p=Mark Handley <+44-171-380-7777>
int ind = rest.indexOf("<");
if (ind != -1) {
retval = rest.substring(0, ind);
} else {
// There is no display name !!!
}
}
return retval;
|
public java.lang.String | getPhoneNumber(java.lang.String rest)Gets the phone number.
String phoneNumber = null;
int begin = rest.indexOf("(");
if (begin != -1) {
// p=+44-171-380-7777 (Mark Handley)
phoneNumber = rest.substring(0, begin).trim();
} else {
// The alternative RFC822 name quoting convention is
// also allowed for email addresses. ex: p=Mark
// Handley <+44-171-380-7777>
int ind = rest.indexOf("<");
int end = rest.indexOf(">");
if (ind != -1 && end != -1 && end > ind) {
phoneNumber = rest.substring(ind+1, end);
} else {
// p=+44-171-380-7777
phoneNumber = rest.trim();
}
}
return phoneNumber;
|
public SDPField | parse()Perform the phone number field parsing
return phoneField();
|
public PhoneField | phoneField()Perform the phone number field parsing
lexer.match('p");
lexer.SPorHT();
lexer.match('=");
lexer.SPorHT();
PhoneField phoneField = new PhoneField();
String rest = lexer.getRest();
String displayName = getDisplayName(rest.trim());
phoneField.setName(displayName);
String phoneNumber = getPhoneNumber(rest);
phoneField.setPhoneNumber(phoneNumber);
return phoneField;
|