当前位置: 首页>>代码示例>>Java>>正文


Java XmppStringUtils.parseLocalpart方法代码示例

本文整理汇总了Java中org.jxmpp.util.XmppStringUtils.parseLocalpart方法的典型用法代码示例。如果您正苦于以下问题:Java XmppStringUtils.parseLocalpart方法的具体用法?Java XmppStringUtils.parseLocalpart怎么用?Java XmppStringUtils.parseLocalpart使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.jxmpp.util.XmppStringUtils的用法示例。


在下文中一共展示了XmppStringUtils.parseLocalpart方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
 
开发者ID:TTalkIM,项目名称:Smack,代码行数:17,代码来源:AbstractDebugger.java

示例2: validateEntityBareJid

import org.jxmpp.util.XmppStringUtils; //导入方法依赖的package包/类
/**
 * Check if the given CharSequence is a valid entity bare JID. That
 * is, it must consists exactly of a local- and a domainpart
 * (<[email protected]>).
 * <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

示例3: bareFrom

import org.jxmpp.util.XmppStringUtils; //导入方法依赖的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

示例4: 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;
}
 
开发者ID:igniterealtime,项目名称:jxmpp,代码行数:25,代码来源:JidCreate.java

示例5: entityBareFrom

import org.jxmpp.util.XmppStringUtils; //导入方法依赖的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

示例6: entityBareFromUnescaped

import org.jxmpp.util.XmppStringUtils; //导入方法依赖的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

示例7: 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;
}
 
开发者ID:igniterealtime,项目名称:jxmpp,代码行数:25,代码来源:JidCreate.java

示例8: 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;
}
 
开发者ID:igniterealtime,项目名称:jxmpp,代码行数:29,代码来源:JidCreate.java

示例9: setConfiguration

import org.jxmpp.util.XmppStringUtils; //导入方法依赖的package包/类
public static Void setConfiguration ( String xmppUser , String xmppPassword ) {
    // TODO: validate xmppUser
    XMPPConnectionManager.isConfigured = true;
    XMPPConnectionManager.xmppPassword = xmppPassword ;
    XMPPConnectionManager.xmppUserName = XmppStringUtils.parseLocalpart( xmppUser ) ;
    XMPPConnectionManager.xmppUserDomain = XmppStringUtils.parseDomain( xmppUser ) ;
    return null;
}
 
开发者ID:marevalo,项目名称:FlowsManager,代码行数:9,代码来源:XMPPConnectionManager.java

示例10: processPacket

import org.jxmpp.util.XmppStringUtils; //导入方法依赖的package包/类
public void processPacket(Stanza packet) {
    if (packet instanceof AgentStatusRequest) {
        AgentStatusRequest statusRequest = (AgentStatusRequest)packet;
        for (Iterator<AgentStatusRequest.Item> i = statusRequest.getAgents().iterator(); i.hasNext();) {
            AgentStatusRequest.Item item = i.next();
            String agentJID = item.getJID();
            if ("remove".equals(item.getType())) {

                // Removing the user from the roster, so remove any presence information
                // about them.
                String key = XmppStringUtils.parseLocalpart(XmppStringUtils.parseLocalpart(agentJID) + "@" +
                        XmppStringUtils.parseDomain(agentJID));
                presenceMap.remove(key);
                // Fire event for roster listeners.
                fireEvent(EVENT_AGENT_REMOVED, agentJID);
            }
            else {
                entries.add(agentJID);
                // Fire event for roster listeners.
                fireEvent(EVENT_AGENT_ADDED, agentJID);
            }
        }

        // Mark the roster as initialized.
        rosterInitialized = true;
    }
}
 
开发者ID:TTalkIM,项目名称:Smack,代码行数:28,代码来源:AgentRoster.java

示例11: 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);
	}
}
 
开发者ID:igniterealtime,项目名称:jxmpp,代码行数:19,代码来源:JidCreate.java

示例12: 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);
	}
}
 
开发者ID:igniterealtime,项目名称:jxmpp,代码行数:21,代码来源:JidCreate.java

示例13: XMPPTCPConnection

import org.jxmpp.util.XmppStringUtils; //导入方法依赖的package包/类
/**
 * Creates a new XMPP connection over TCP.
 * <p>
 * Note that {@code jid} must be the bare JID, e.g. "[email protected]". More fine-grained control over the
 * connection settings is available using the {@link #XMPPTCPConnection(XMPPTCPConnectionConfiguration)}
 * constructor.
 * </p>
 * 
 * @param jid the bare JID used by the client.
 * @param password the password or authentication token.
 */
public XMPPTCPConnection(CharSequence jid, String password) {
    this(XmppStringUtils.parseLocalpart(jid.toString()), password, XmppStringUtils.parseDomain(jid.toString()));
}
 
开发者ID:TTalkIM,项目名称:Smack,代码行数:15,代码来源:XMPPTCPConnection.java

示例14: XMPPTCPConnection

import org.jxmpp.util.XmppStringUtils; //导入方法依赖的package包/类
/**
 * Creates a new XMPP connection over TCP.
 * <p>
 * Note that {@code jid} must be the bare JID, e.g. "[email protected]". More fine-grained control over the
 * connection settings is available using the {@link #XMPPTCPConnection(XMPPTCPConnectionConfiguration)}
 * constructor.
 * </p>
 *
 * @param jid the bare JID used by the client.
 * @param password the password or authentication token.
 * @throws XmppStringprepException
 */
public XMPPTCPConnection(CharSequence jid, String password) throws XmppStringprepException {
    this(XmppStringUtils.parseLocalpart(jid.toString()), password, XmppStringUtils.parseDomain(jid.toString()));
}
 
开发者ID:kontalk,项目名称:androidclient,代码行数:16,代码来源:XMPPTCPConnection.java


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