• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java XmppStringprepException类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.jxmpp.stringprep.XmppStringprepException的典型用法代码示例。如果您正苦于以下问题:Java XmppStringprepException类的具体用法?Java XmppStringprepException怎么用?Java XmppStringprepException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



XmppStringprepException类属于org.jxmpp.stringprep包,在下文中一共展示了XmppStringprepException类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: removeContact

import org.jxmpp.stringprep.XmppStringprepException; //导入依赖的package包/类
public void removeContact(String jidString)
        throws SmackException.NotLoggedInException, InterruptedException,
        SmackException.NotConnectedException, XMPPException.XMPPErrorException,
        SmackException.NoResponseException, XmppStringprepException {
    Roster roster = Roster.getInstanceFor(XMPPSession.getInstance().getXMPPConnection());
    if (!roster.isLoaded()) {
        roster.reloadAndWait();
    }

    BareJid jid = JidCreate.bareFrom(jidString);
    roster.removeEntry(roster.getEntry(jid));

    Presence presence = new Presence(Presence.Type.unsubscribe);
    presence.setTo(JidCreate.from(jidString));
    XMPPSession.getInstance().sendStanza(presence);
}
 
开发者ID:esl,项目名称:mangosta-android,代码行数:17,代码来源:RosterManager.java


示例2: addContact

import org.jxmpp.stringprep.XmppStringprepException; //导入依赖的package包/类
public void addContact(String jidString)
        throws SmackException.NotLoggedInException, InterruptedException,
        SmackException.NotConnectedException, XMPPException.XMPPErrorException,
        SmackException.NoResponseException, XmppStringprepException {
    Roster roster = Roster.getInstanceFor(XMPPSession.getInstance().getXMPPConnection());
    if (!roster.isLoaded()) {
        roster.reloadAndWait();
    }

    BareJid jid = JidCreate.bareFrom(jidString);
    String name = XMPPUtils.fromJIDToUserName(jidString);
    String[] groups = new String[]{"Buddies"};

    roster.createEntry(jid, name, groups);
    roster.sendSubscriptionRequest(jid);
}
 
开发者ID:esl,项目名称:mangosta-android,代码行数:17,代码来源:RosterManager.java


示例3: getMessages

import org.jxmpp.stringprep.XmppStringprepException; //导入依赖的package包/类
@SuppressWarnings({ "unchecked", "rawtypes" })
public static MyListWrapper<MessageItem> getMessages(String jid) throws XmppStringprepException {
	if (get().messages.containsKey(JidCreate.domainBareFrom(jid))) {
		return get().messages.get(JidCreate.domainBareFrom(jid));
	}

	MyListWrapper<MessageItem> msgs = null;
	try {
		msgs = new MyListWrapper(DatabaseHelper.getInstance(LiveApp.get())
				.getDao(MessageItem.class)
				.queryForEq("opponent", JidCreate.domainBareFrom(jid)));
	} catch (SQLException e) {
		msgs = new MyListWrapper<MessageItem>();
	}
	get().messages.put((jid), msgs);
	return msgs;
}
 
开发者ID:saveendhiman,项目名称:XMPPSample_Studio,代码行数:18,代码来源:DataProvider.java


示例4: fromCursor

import org.jxmpp.stringprep.XmppStringprepException; //导入依赖的package包/类
private RosterPacket.Item fromCursor(Cursor c) throws XmppStringprepException {
    String user = c.getString(0);
    String name = c.getString(1);
    RosterPacket.Item item = new RosterPacket.Item(JidCreate.bareFrom(user), name);
    String type = c.getString(2);
    if (type == null)
        type = RosterPacket.ItemType.none.toString();
    item.setItemType(RosterPacket.ItemType.valueOf(type));

    boolean pending = c.getInt(3) != 0;
    item.setSubscriptionPending(pending);

    boolean approved = c.getInt(4) != 0;
    item.setApproved(approved);

    String groups = c.getString(5);
    if (groups != null) {
        StringTokenizer tokenizer = new StringTokenizer(groups, ",");
        while (tokenizer.hasMoreTokens()) {
            item.addGroupName(tokenizer.nextToken());
        }
    }

    return item;
}
 
开发者ID:kontalk,项目名称:androidclient,代码行数:26,代码来源:SQLiteRosterStore.java


示例5: handleVersion

import org.jxmpp.stringprep.XmppStringprepException; //导入依赖的package包/类
@CommandHandler(name = ACTION_VERSION)
private boolean handleVersion(Intent intent) {
    if (isConnected()) {
        try {
            Version version = new Version(JidCreate.from(intent.getStringExtra(EXTRA_TO)));
            version.setStanzaId(intent.getStringExtra(EXTRA_PACKET_ID));
            sendPacket(version);
        }
        catch (XmppStringprepException e) {
            Log.w(TAG, "error parsing JID: " + e.getCausingString(), e);
            // report it because it's a big deal
            ReportingManager.logException(e);
        }
    }
    return false;
}
 
开发者ID:kontalk,项目名称:androidclient,代码行数:17,代码来源:MessageCenterService.java


示例6: sendPushRegistration

import org.jxmpp.stringprep.XmppStringprepException; //导入依赖的package包/类
private void sendPushRegistration(final String regId) {
    IQ iq = PushRegistration.register(DEFAULT_PUSH_PROVIDER, regId);
    try {
        iq.setTo(JidCreate.from("push", mServer.getNetwork(), ""));
    }
    catch (XmppStringprepException e) {
        Log.w(TAG, "error parsing JID: " + e.getCausingString(), e);
        // report it because it's a big deal
        ReportingManager.logException(e);
        return;
    }

    sendIqWithReply(iq, true, new StanzaListener() {
        @Override
        public void processStanza(Stanza packet) throws NotConnectedException {
            if (mPushService != null)
                mPushService.setRegisteredOnServer(regId != null);
        }
    }, null);
}
 
开发者ID:kontalk,项目名称:androidclient,代码行数:21,代码来源:MessageCenterService.java


示例7: sendPushUnregistration

import org.jxmpp.stringprep.XmppStringprepException; //导入依赖的package包/类
private void sendPushUnregistration() {
    IQ iq = PushRegistration.unregister(DEFAULT_PUSH_PROVIDER);
    try {
        iq.setTo(JidCreate.from("push", mServer.getNetwork(), ""));
    }
    catch (XmppStringprepException e) {
        Log.w(TAG, "error parsing JID: " + e.getCausingString(), e);
        // report it because it's a big deal
        ReportingManager.logException(e);
        return;
    }

    sendIqWithReply(iq, true, new StanzaListener() {
        @Override
        public void processStanza(Stanza packet) throws NotConnectedException {
            if (mPushService != null)
                mPushService.setRegisteredOnServer(false);
        }
    }, null);
}
 
开发者ID:kontalk,项目名称:androidclient,代码行数:21,代码来源:MessageCenterService.java


示例8: KontalkConnection

import org.jxmpp.stringprep.XmppStringprepException; //导入依赖的package包/类
public KontalkConnection(String resource, EndpointServer server, boolean secure,
        PrivateKey privateKey, X509Certificate bridgeCert,
        boolean acceptAnyCertificate, KeyStore trustStore, String legacyAuthToken) throws XMPPException, XmppStringprepException {

    super(buildConfiguration(resource, server, secure,
        privateKey, bridgeCert, acceptAnyCertificate, trustStore, legacyAuthToken));

    mServer = server;

    // enable SM without resumption
    setUseStreamManagement(true);
    setUseStreamManagementResumption(false);
    // set custom ack predicate
    addRequestAckPredicate(AckPredicate.INSTANCE);
    // set custom packet reply timeout
    setPacketReplyTimeout(DEFAULT_PACKET_TIMEOUT);
}
 
开发者ID:kontalk,项目名称:androidclient,代码行数:18,代码来源:KontalkConnection.java


示例9: from

import org.jxmpp.stringprep.XmppStringprepException; //导入依赖的package包/类
/**
 * Get the {@link Domainpart} representing the input String.
 *
 * @param domain the input String.
 * @return the domainpart.
 * @throws XmppStringprepException if an error occurs.
 */
public static Domainpart from(String domain) throws XmppStringprepException {
	if (domain == null) {
		throw new XmppStringprepException(domain, "Input 'domain' must not be null");
	}
	// TODO cache
	// RFC 6122 § 2.2 "If the domainpart includes a final character considered to be a label
	// separator (dot) by [IDNA2003] or [DNS], this character MUST be stripped …"
	if (domain.length() > 0 && domain.charAt(domain.length() - 1) == '.') {
		domain = domain.substring(0, domain.length() - 1);
	}
	domain = XmppStringPrepUtil.domainprep(domain);
	// First prep the String, then assure the limits of the *result*
	assertNotLongerThan1023BytesOrEmpty(domain);
	return new Domainpart(domain);
}
 
开发者ID:igniterealtime,项目名称:jxmpp,代码行数:23,代码来源:Domainpart.java


示例10: validateEntityBareJid

import org.jxmpp.stringprep.XmppStringprepException; //导入依赖的package包/类
/**
 * Check if the given CharSequence is a valid entity bare JID. That
 * is, it must consists exactly of a local- and a domainpart
 * (&lt;[email protected]&gt;).
 * <p>
 * This is a convenience method meant to validate user entered bare JIDs. If
 * the given {@code jid} is not a valid bare JID, then this method will
 * throw either {@link NotAEntityBareJidStringException} or
 * {@link XmppStringprepException}. The NotABareJidStringException will
 * contain a meaningful message explaining why the given CharSequence is not a
 * valid bare JID (e.g. "does not contain a '@' character").
 * </p>
 * 
 * @param jidcs the JID CharSequence
 * @return a BareJid instance representing the given JID CharSequence
 * @throws NotAEntityBareJidStringException if the given CharSequence is not a bare JID.
 * @throws XmppStringprepException if an error happens.
 */
public static EntityBareJid validateEntityBareJid(CharSequence jidcs) throws NotAEntityBareJidStringException, XmppStringprepException {
	String jid = jidcs.toString();
	final int atIndex = jid.indexOf('@');
	if (atIndex == -1) {
		throw new NotAEntityBareJidStringException("'" + jid + "' does not contain a '@' character");
	} else if (jid.indexOf('@', atIndex + 1) != -1) {
		throw new NotAEntityBareJidStringException("'" + jid + "' contains multiple '@' characters");
	}
	final String localpart = XmppStringUtils.parseLocalpart(jid);
	if (localpart.length() == 0) {
		throw new NotAEntityBareJidStringException("'" + jid + "' has empty localpart");
	}
	final String domainpart = XmppStringUtils.parseDomain(jid);
	if (domainpart.length() == 0) {
		throw new NotAEntityBareJidStringException("'" + jid + "' has empty domainpart");
	}
	return JidCreate.entityBareFromUnescaped(jid);
}
 
开发者ID:igniterealtime,项目名称:jxmpp,代码行数:37,代码来源:JidUtil.java


示例11: entityBareJidsFrom

import org.jxmpp.stringprep.XmppStringprepException; //导入依赖的package包/类
/**
 * Convert a collection of Strings to a Set of {@link EntityBareJid}'s.
 * <p>
 * If the optional argument <code>exceptions</code> is given, then all {@link XmppStringprepException} thrown while
 * converting will be added to the list. Otherwise, if an XmppStringprepExceptions is thrown, it will be wrapped in
 * a AssertionError Exception and throw.
 * </p>
 * 
 * @param jidStrings
 *            the strings that are going to get converted
 * @param output
 *            the collection where the BareJid's will be added to
 * @param exceptions the list of exceptions thrown while converting.
 */
public static void entityBareJidsFrom(Collection<? extends CharSequence> jidStrings, Collection<? super EntityBareJid> output,
		List<XmppStringprepException> exceptions) {
	for (CharSequence jid : jidStrings) {
		try {
			EntityBareJid bareJid = JidCreate.entityBareFrom(jid);
			output.add(bareJid);
		} catch (XmppStringprepException e) {
			if (exceptions != null) {
				exceptions.add(e);
			} else {
				throw new AssertionError(e);
			}
		}
	}
}
 
开发者ID:igniterealtime,项目名称:jxmpp,代码行数:30,代码来源:JidUtil.java


示例12: jidsFrom

import org.jxmpp.stringprep.XmppStringprepException; //导入依赖的package包/类
/**
 * Convert a collection of Strings to a Set of {@link Jid}'s.
 * <p>
 * If the optional argument <code>exceptions</code> is given, then all {@link XmppStringprepException} thrown while
 * converting will be added to the list. Otherwise, if an XmppStringprepExceptions is thrown, it will be wrapped in
 * a AssertionError Exception and throw.
 * </p>
 * 
 * @param jidStrings
 *            the strings that are going to get converted
 * @param output
 *            the collection where the Jid's will be added to
 * @param exceptions the list of exceptions thrown while converting.
 */
public static void jidsFrom(Collection<? extends CharSequence> jidStrings, Collection<? super Jid> output,
		List<XmppStringprepException> exceptions) {
	for (CharSequence jidString : jidStrings) {
		try {
			Jid jid = JidCreate.from(jidString);
			output.add(jid);
		} catch (XmppStringprepException e) {
			if (exceptions != null) {
				exceptions.add(e);
			} else {
				throw new AssertionError(e);
			}
		}
	}
}
 
开发者ID:igniterealtime,项目名称:jxmpp,代码行数:30,代码来源:JidUtil.java


示例13: from

import org.jxmpp.stringprep.XmppStringprepException; //导入依赖的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;
}
 
开发者ID:igniterealtime,项目名称:jxmpp,代码行数:33,代码来源:JidCreate.java


示例14: bareFrom

import org.jxmpp.stringprep.XmppStringprepException; //导入依赖的package包/类
/**
 * Get a {@link BareJid} representing the given String.
 *
 * @param jid the input String.
 * @return a bare JID representing the given String.
 * @throws XmppStringprepException if an error occurs.
 */
public static BareJid bareFrom(String jid) throws XmppStringprepException {
	BareJid bareJid = BAREJID_CACHE.lookup(jid);
	if (bareJid != null) {
		return bareJid;
	}

	String localpart = XmppStringUtils.parseLocalpart(jid);
	String domainpart = XmppStringUtils.parseDomain(jid);
	try {
		if (localpart.length() != 0) {
			bareJid = new LocalAndDomainpartJid(localpart, domainpart);
		} else {
			bareJid = new DomainpartJid(domainpart);
		}
	} catch (XmppStringprepException e) {
		throw new XmppStringprepException(jid, e);
	}
	BAREJID_CACHE.put(jid, bareJid);
	return bareJid;
}
 
开发者ID:igniterealtime,项目名称:jxmpp,代码行数:28,代码来源:JidCreate.java


示例15: fullFrom

import org.jxmpp.stringprep.XmppStringprepException; //导入依赖的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;
}
 
开发者ID:igniterealtime,项目名称:jxmpp,代码行数:25,代码来源:JidCreate.java


示例16: entityBareFrom

import org.jxmpp.stringprep.XmppStringprepException; //导入依赖的package包/类
/**
 * Get a {@link EntityBareJid} representing the given String.
 *
 * @param jid the input String.
 * @return a bare JID representing the given String.
 * @throws XmppStringprepException if an error occurs.
 */
public static EntityBareJid entityBareFrom(String jid) throws XmppStringprepException {
	EntityBareJid bareJid = ENTITY_BAREJID_CACHE.lookup(jid);
	if (bareJid != null) {
		return bareJid;
	}

	String localpart = XmppStringUtils.parseLocalpart(jid);
	String domainpart = XmppStringUtils.parseDomain(jid);
	try {
		bareJid = new LocalAndDomainpartJid(localpart, domainpart);
	} catch (XmppStringprepException e) {
		throw new XmppStringprepException(jid, e);
	}
	ENTITY_BAREJID_CACHE.put(jid, bareJid);
	return bareJid;
}
 
开发者ID:igniterealtime,项目名称:jxmpp,代码行数:24,代码来源:JidCreate.java


示例17: entityBareFromUnescaped

import org.jxmpp.stringprep.XmppStringprepException; //导入依赖的package包/类
/**
 * Get a {@link EntityBareJid} representing the given unescaped String.
 *
 * @param unescapedJidString the input String.
 * @return a bare JID representing the given String.
 * @throws XmppStringprepException if an error occurs.
 */
public static EntityBareJid entityBareFromUnescaped(String unescapedJidString) throws XmppStringprepException {
	EntityBareJid bareJid = ENTITY_BAREJID_CACHE.lookup(unescapedJidString);
	if (bareJid != null) {
		return bareJid;
	}

	String localpart = XmppStringUtils.parseLocalpart(unescapedJidString);
	// Some as from(String), but we escape the localpart
	localpart = XmppStringUtils.escapeLocalpart(localpart);

	String domainpart = XmppStringUtils.parseDomain(unescapedJidString);
	try {
		bareJid = new LocalAndDomainpartJid(localpart, domainpart);
	} catch (XmppStringprepException e) {
		throw new XmppStringprepException(unescapedJidString, e);
	}
	ENTITY_BAREJID_CACHE.put(unescapedJidString, bareJid);
	return bareJid;
}
 
开发者ID:igniterealtime,项目名称:jxmpp,代码行数:27,代码来源:JidCreate.java


示例18: entityFullFrom

import org.jxmpp.stringprep.XmppStringprepException; //导入依赖的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;
}
 
开发者ID:igniterealtime,项目名称:jxmpp,代码行数:25,代码来源:JidCreate.java


示例19: entityFullFromUnescaped

import org.jxmpp.stringprep.XmppStringprepException; //导入依赖的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;
}
 
开发者ID:igniterealtime,项目名称:jxmpp,代码行数:29,代码来源:JidCreate.java


示例20: domainBareFrom

import org.jxmpp.stringprep.XmppStringprepException; //导入依赖的package包/类
/**
 * Get a domain bare JID.
 *
 * @param jid the JID String.
 * @return a domain bare JID.
 * @throws XmppStringprepException if an error occurs.
 */
public static DomainBareJid domainBareFrom(String jid) throws XmppStringprepException {
	DomainBareJid domainJid = DOMAINJID_CACHE.lookup(jid);
	if (domainJid != null) {
		return domainJid;
	}

	String domain = XmppStringUtils.parseDomain(jid);
	try {
		domainJid = new DomainpartJid(domain);
	} catch (XmppStringprepException e) {
		throw new XmppStringprepException(jid, e);
	}
	DOMAINJID_CACHE.put(jid, domainJid);
	return domainJid;
}
 
开发者ID:igniterealtime,项目名称:jxmpp,代码行数:23,代码来源:JidCreate.java



注:本文中的org.jxmpp.stringprep.XmppStringprepException类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ValidationProvider类代码示例发布时间:2022-05-22
下一篇:
Java ResultSet类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap