Methods Summary |
---|
public Address | createAddress(java.lang.String displayName, URI uri)Creates anAddress with the new display name and URI attribute
values.
if (uri == null)
throw new NullPointerException("null URI");
Address addressImpl = new Address();
if (displayName != null) addressImpl.setDisplayName(displayName);
addressImpl.setURI(uri);
return addressImpl;
|
public Address | createAddress(URI uri)Creates a new address.
if (uri == null)
throw new NullPointerException("null address");
Address addressImpl = new Address();
addressImpl.setURI(uri);
return addressImpl;
|
public Address | createAddress(java.lang.String address)Creates anAddress with the new address string value. The address
string is parsed in order to create the new Address instance. Create
with a String value of "*" creates a wildcard address. The wildcard
can be determined if
(SipURIAddress.getURI).getUser() == *; .
if (address == null)
throw new NullPointerException("null address");
if (address.equals("*")) {
Address addressImpl = new Address();
addressImpl.setAddressType(Address.WILD_CARD);
return addressImpl;
} else {
StringMsgParser smp = new StringMsgParser();
return smp.parseAddress(address);
}
|
public SipURI | createSipURI(java.lang.String uri)Creates a sip uri.
if (uri == null)
throw new NullPointerException("null URI");
try {
StringMsgParser smp = new StringMsgParser();
SipURI sipUri = smp.parseSIPUrl(uri);
return (SipURI) sipUri;
} catch (ParseException ex) {
// throw new java.netURISyntaxException(uri, ex.getMessage());
throw new ParseException(ex.getMessage(), 0);
}
|
public SipURI | createSipURI(java.lang.String user, java.lang.String host)Creates a SipURI.
if (host == null)
throw new NullPointerException("null host");
StringBuffer uriString = new StringBuffer("sip:");
if (user != null) {
uriString.append(user);
uriString.append("@");
}
// if host is an IPv6 string we should enclose it in sq brackets
if (host.indexOf(':") != host.lastIndexOf(':")
&& host.trim().charAt(0) != '[")
host = '[" + host + ']";
uriString.append(host);
StringMsgParser smp = new StringMsgParser();
try {
SipURI sipUri = smp.parseSIPUrl(uriString.toString());
return sipUri;
} catch (ParseException ex) {
throw new ParseException(ex.getMessage(), 0);
}
|
public TelURL | createTelURL(java.lang.String uri)Creates a TelURL based on given URI string. The scheme or '+' should
not be included in the phoneNumber string argument.
if (uri == null)
throw new NullPointerException("null url");
String telUrl = "tel:" + uri;
try {
StringMsgParser smp = new StringMsgParser();
TelURL timp = (TelURL) smp.parseUrl(telUrl);
return (TelURL) timp;
} catch (ParseException ex) {
throw new ParseException(ex.getMessage(), 0);
}
|
public URI | createURI(java.lang.String uri)Creates a URI based on given URI string. The URI string is parsed in
order to create the new URI instance. Depending on the scheme the
returned may or may not be aSipURI or TelURL cast as a URI.
if (uri == null)
throw new NullPointerException("null arg");
try {
Lexer lexer = new Lexer("sip_urlLexer", uri);
Token token = lexer.peekNextToken();
// For cases when URI begins with "<" and for TCK passing
if (token.getTokenType() == LexerCore.LESS_THAN) {
lexer.consume();
token = lexer.peekNextToken();
uri = uri.substring(uri.indexOf(LexerCore.LESS_THAN)+1,
uri.lastIndexOf(LexerCore.GREATER_THAN));
}
URLParser urlParser = new URLParser(uri);
String scheme = token.getTokenValue();
if (scheme == null || !Lexer.isValidScheme(scheme))
throw new ParseException("bad scheme", 0);
if (Utils.equalsIgnoreCase(scheme, SIPConstants.SCHEME_SIP)) {
return (URI) urlParser.sipURL(token);
} else if (Utils.equalsIgnoreCase(scheme,
SIPConstants.SCHEME_SIPS)) {
return (URI) urlParser.sipURL(token);
} else if (Utils.equalsIgnoreCase(scheme,
SIPConstants.SCHEME_TEL)) {
return (URI) urlParser.telURL();
}
} catch (ParseException ex) {
throw new ParseException(ex.getMessage(), 0);
}
return new URI(uri);
|