本文整理汇总了Java中org.jxmpp.util.XmppStringUtils.parseResource方法的典型用法代码示例。如果您正苦于以下问题:Java XmppStringUtils.parseResource方法的具体用法?Java XmppStringUtils.parseResource怎么用?Java XmppStringUtils.parseResource使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jxmpp.util.XmppStringUtils
的用法示例。
在下文中一共展示了XmppStringUtils.parseResource方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: userHasLogged
import org.jxmpp.util.XmppStringUtils; //导入方法依赖的package包/类
public void userHasLogged(String user) {
String localpart = XmppStringUtils.parseLocalpart(user);
boolean isAnonymous = "".equals(localpart);
String title =
"User logged (" + connection.getConnectionCounter() + "): "
+ (isAnonymous ? "" : localpart)
+ "@"
+ connection.getServiceName()
+ ":"
+ connection.getPort();
title += "/" + XmppStringUtils.parseResource(user);
log(title);
// Add the connection listener to the connection so that the debugger can be notified
// whenever the connection is closed.
connection.addConnectionListener(connListener);
}
示例2: createRxMessage
import org.jxmpp.util.XmppStringUtils; //导入方法依赖的package包/类
public static XmppRxMessage createRxMessage(org.jivesoftware.smack.packet.Message xmppMessage){
MessageContent content = new DefaultMessageContent(xmppMessage.getBody());
Resource resource;
if(xmppMessage.getType().equals(org.jivesoftware.smack.packet.Message.Type.groupchat)){
resource =
new DefaultResource(
XmppStringUtils.parseBareJid(xmppMessage.getFrom()),
XmppStringUtils.parseResource(xmppMessage.getFrom()),
Resource.Type.ROOM
);
}else{
resource = new DefaultResource(xmppMessage.getFrom(),xmppMessage.getFrom(), Resource.Type.USER);
}
XmppRxMessage msg = new XmppRxMessage(resource,content);
msg.setId(xmppMessage.getStanzaId());
msg.setThread(xmppMessage.getThread());
return msg;
}
示例3: fullFrom
import org.jxmpp.util.XmppStringUtils; //导入方法依赖的package包/类
/**
* Get a {@link FullJid} representing the given String.
*
* @param jid the JID's String.
* @return a full JID representing the input String.
* @throws XmppStringprepException if an error occurs.
*/
public static FullJid fullFrom(String jid) throws XmppStringprepException {
FullJid fullJid = FULLJID_CACHE.lookup(jid);
if (fullJid != null) {
return fullJid;
}
String localpart = XmppStringUtils.parseLocalpart(jid);
String domainpart = XmppStringUtils.parseDomain(jid);
String resource = XmppStringUtils.parseResource(jid);
try {
fullJid = fullFrom(localpart, domainpart, resource);
} catch (XmppStringprepException e) {
throw new XmppStringprepException(jid, e);
}
FULLJID_CACHE.put(jid, fullJid);
return fullJid;
}
示例4: entityFullFrom
import org.jxmpp.util.XmppStringUtils; //导入方法依赖的package包/类
/**
* Get a {@link EntityFullJid} representing the given String.
*
* @param jid the JID's String.
* @return a full JID representing the input String.
* @throws XmppStringprepException if an error occurs.
*/
public static EntityFullJid entityFullFrom(String jid) throws XmppStringprepException {
EntityFullJid fullJid = ENTITY_FULLJID_CACHE.lookup(jid);
if (fullJid != null) {
return fullJid;
}
String localpart = XmppStringUtils.parseLocalpart(jid);
String domainpart = XmppStringUtils.parseDomain(jid);
String resource = XmppStringUtils.parseResource(jid);
try {
fullJid = entityFullFrom(localpart, domainpart, resource);
} catch (XmppStringprepException e) {
throw new XmppStringprepException(jid, e);
}
ENTITY_FULLJID_CACHE.put(jid, fullJid);
return fullJid;
}
示例5: entityFullFromUnescaped
import org.jxmpp.util.XmppStringUtils; //导入方法依赖的package包/类
/**
* Get a {@link EntityFullJid} representing the given unescaped String.
*
* @param unescapedJidString the JID's String.
* @return a full JID representing the input String.
* @throws XmppStringprepException if an error occurs.
*/
public static EntityFullJid entityFullFromUnescaped(String unescapedJidString) throws XmppStringprepException {
EntityFullJid fullJid = ENTITY_FULLJID_CACHE.lookup(unescapedJidString);
if (fullJid != null) {
return fullJid;
}
String localpart = XmppStringUtils.parseLocalpart(unescapedJidString);
// Some as from(String), but we escape the localpart
localpart = XmppStringUtils.escapeLocalpart(localpart);
String domainpart = XmppStringUtils.parseDomain(unescapedJidString);
String resource = XmppStringUtils.parseResource(unescapedJidString);
try {
fullJid = new LocalDomainAndResourcepartJid(localpart, domainpart, resource);
} catch (XmppStringprepException e) {
throw new XmppStringprepException(unescapedJidString, e);
}
ENTITY_FULLJID_CACHE.put(unescapedJidString, fullJid);
return fullJid;
}
示例6: domainFullFrom
import org.jxmpp.util.XmppStringUtils; //导入方法依赖的package包/类
/**
* Get a domain full JID from the given String.
*
* @param jid the JID.
* @return a DomainFullJid.
* @throws XmppStringprepException if an error happens.
*/
public static DomainFullJid domainFullFrom(String jid) throws XmppStringprepException {
DomainFullJid domainResourceJid = DOMAINRESOURCEJID_CACHE.lookup(jid);
if (domainResourceJid != null) {
return domainResourceJid;
}
String domain = XmppStringUtils.parseDomain(jid);
String resource = XmppStringUtils.parseResource(jid);
try {
domainResourceJid = new DomainAndResourcepartJid(domain, resource);
} catch (XmppStringprepException e) {
throw new XmppStringprepException(jid, e);
}
DOMAINRESOURCEJID_CACHE.put(jid, domainResourceJid);
return domainResourceJid;
}
示例7: userHasLogged
import org.jxmpp.util.XmppStringUtils; //导入方法依赖的package包/类
public void userHasLogged(String user) {
boolean isAnonymous = "".equals(XmppStringUtils.parseLocalpart(user));
String title =
"Smack Debug Window -- "
+ (isAnonymous ? "" : XmppStringUtils.parseBareJid(user))
+ "@"
+ connection.getServiceName()
+ ":"
+ connection.getPort();
title += "/" + XmppStringUtils.parseResource(user);
frame.setTitle(title);
}
示例8: Occupant
import org.jxmpp.util.XmppStringUtils; //导入方法依赖的package包/类
Occupant(Presence presence) {
MUCUser mucUser = (MUCUser) presence.getExtension("x",
"http://jabber.org/protocol/muc#user");
MUCItem item = mucUser.getItem();
this.jid = item.getJid();
this.affiliation = item.getAffiliation();
this.role = item.getRole();
// Get the nickname from the FROM attribute of the presence
this.nick = XmppStringUtils.parseResource(presence.getFrom());
}
示例9: from
import org.jxmpp.util.XmppStringUtils; //导入方法依赖的package包/类
/**
* Get a {@link Jid} from the given String.
*
* @param jidString the input String.
* @return the Jid represented by the input String.
* @throws XmppStringprepException if an error occurs.
* @see #from(CharSequence)
*/
public static Jid from(String jidString) throws XmppStringprepException {
String localpart = XmppStringUtils.parseLocalpart(jidString);
String domainpart = XmppStringUtils.parseDomain(jidString);
String resource = XmppStringUtils.parseResource(jidString);
try {
return from(localpart, domainpart, resource);
} catch (XmppStringprepException e) {
throw new XmppStringprepException(jidString, e);
}
}
示例10: fromUnescaped
import org.jxmpp.util.XmppStringUtils; //导入方法依赖的package包/类
/**
* Get a {@link Jid} from the given unescaped String.
*
* @param unescapedJidString a unescaped String representing a JID.
* @return a JID.
* @throws XmppStringprepException if an error occurs.
*/
public static Jid fromUnescaped(String unescapedJidString) throws XmppStringprepException {
String localpart = XmppStringUtils.parseLocalpart(unescapedJidString);
// Some as from(String), but we escape the localpart
localpart = XmppStringUtils.escapeLocalpart(localpart);
String domainpart = XmppStringUtils.parseDomain(unescapedJidString);
String resource = XmppStringUtils.parseResource(unescapedJidString);
try {
return from(localpart, domainpart, resource);
} catch (XmppStringprepException e) {
throw new XmppStringprepException(unescapedJidString, e);
}
}