本文整理汇总了Java中org.jxmpp.util.XmppStringUtils.completeJidFrom方法的典型用法代码示例。如果您正苦于以下问题:Java XmppStringUtils.completeJidFrom方法的具体用法?Java XmppStringUtils.completeJidFrom怎么用?Java XmppStringUtils.completeJidFrom使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jxmpp.util.XmppStringUtils
的用法示例。
在下文中一共展示了XmppStringUtils.completeJidFrom方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: openStream
import org.jxmpp.util.XmppStringUtils; //导入方法依赖的package包/类
/**
* Resets the parser using the latest connection's reader. Reseting the parser is necessary
* when the plain connection has been secured or when a new opening stream element is going
* to be sent by the server.
*
* @throws SmackException if the parser could not be reset.
*/
void openStream() throws SmackException {
// If possible, provide the receiving entity of the stream open tag, i.e. the server, as much information as
// possible. The 'to' attribute is *always* available. The 'from' attribute if set by the user and no external
// mechanism is used to determine the local entity (user). And the 'id' attribute is available after the first
// response from the server (see e.g. RFC 6120 § 9.1.1 Step 2.)
CharSequence to = getServiceName();
CharSequence from = null;
CharSequence localpart = config.getUsername();
if (localpart != null) {
from = XmppStringUtils.completeJidFrom(localpart, to);
}
String id = getStreamId();
// 发送一个SteamOpen
send(new StreamOpen(to, from, id));
try {
packetReader.parser = PacketParserUtils.newXmppParser(reader);
}
catch (XmlPullParserException e) {
throw new SmackException(e);
}
}
示例2: openStream
import org.jxmpp.util.XmppStringUtils; //导入方法依赖的package包/类
/**
* Resets the parser using the latest connection's reader. Reseting the parser is necessary
* when the plain connection has been secured or when a new opening stream element is going
* to be sent by the server.
*
* @throws SmackException if the parser could not be reset.
* @throws InterruptedException
*/
void openStream() throws SmackException, InterruptedException {
// If possible, provide the receiving entity of the stream open tag, i.e. the server, as much information as
// possible. The 'to' attribute is *always* available. The 'from' attribute if set by the user and no external
// mechanism is used to determine the local entity (user). And the 'id' attribute is available after the first
// response from the server (see e.g. RFC 6120 § 9.1.1 Step 2.)
CharSequence to = getXMPPServiceDomain();
CharSequence from = null;
CharSequence localpart = config.getUsername();
if (localpart != null) {
from = XmppStringUtils.completeJidFrom(localpart, to);
}
String id = getStreamId();
sendNonza(new StreamOpen(to, from, id));
try {
packetReader.parser = PacketParserUtils.newXmppParser(reader);
}
catch (XmlPullParserException e) {
throw new SmackException(e);
}
}
示例3: from
import org.jxmpp.util.XmppStringUtils; //导入方法依赖的package包/类
/**
* Get a {@link Jid} from the given parts.
* <p>
* Only the domainpart is required.
* </p>
*
* @param localpart a optional localpart.
* @param domainpart a required domainpart.
* @param resource a optional resourcepart.
* @return a JID which consists of the given parts.
* @throws XmppStringprepException if an error occurs.
*/
public static Jid from(String localpart, String domainpart, String resource) throws XmppStringprepException {
String jidString = XmppStringUtils.completeJidFrom(localpart, domainpart, resource);
Jid jid = JID_CACHE.lookup(jidString);
if (jid != null) {
return jid;
}
if (localpart.length() > 0 && domainpart.length() > 0 && resource.length() > 0) {
jid = new LocalDomainAndResourcepartJid(localpart, domainpart, resource);
} else if (localpart.length() > 0 && domainpart.length() > 0 && resource.length() == 0) {
jid = new LocalAndDomainpartJid(localpart, domainpart);
} else if (localpart.length() == 0 && domainpart.length() > 0 && resource.length() == 0) {
jid = new DomainpartJid(domainpart);
} else if (localpart.length() == 0 && domainpart.length() > 0 && resource.length() > 0) {
jid = new DomainAndResourcepartJid(domainpart, resource);
} else {
throw new IllegalArgumentException("Not a valid combination of localpart, domainpart and resource");
}
JID_CACHE.put(jidString, jid);
return jid;
}
示例4: createGroupJid
import org.jxmpp.util.XmppStringUtils; //导入方法依赖的package包/类
public static String createGroupJid(String groupId, String groupOwner) {
return XmppStringUtils.completeJidFrom(groupId, groupOwner);
}
示例5: createLocalJID
import org.jxmpp.util.XmppStringUtils; //导入方法依赖的package包/类
public static String createLocalJID(Context context, String name) {
EndpointServer server = Preferences.getEndpointServer(context);
if (server == null)
throw new IllegalArgumentException("server is null");
return XmppStringUtils.completeJidFrom(name, server.getNetwork());
}
示例6: string
import org.jxmpp.util.XmppStringUtils; //导入方法依赖的package包/类
/** Return JID as escaped string. */
public String string() {
return XmppStringUtils.completeJidFrom(mLocal, mDomain, mResource);
}
示例7: asUnescapedString
import org.jxmpp.util.XmppStringUtils; //导入方法依赖的package包/类
public String asUnescapedString() {
return XmppStringUtils.completeJidFrom(this.local(), mDomain, mResource);
}