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


Java StreamError类代码示例

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


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

示例1: connectionClosedOnError

import org.jivesoftware.smack.packet.StreamError; //导入依赖的package包/类
public void connectionClosedOnError(Exception e) {
    done = false;
    if (e instanceof XMPPException) {
        XMPPException xmppEx = (XMPPException) e;
        StreamError error = xmppEx.getStreamError();

        // Make sure the error is not null
        if (error != null) {
            String reason = error.getCode();

            if ("conflict".equals(reason)) {
                return;
            }
        }
    }

    if (this.isReconnectionAllowed()) {
        this.reconnect();
    }
}
 
开发者ID:ice-coffee,项目名称:EIM,代码行数:21,代码来源:ReconnectionManager.java

示例2: connectionClosedOnError

import org.jivesoftware.smack.packet.StreamError; //导入依赖的package包/类
public void connectionClosedOnError(Exception e) {
	done = false;
	if (e instanceof XMPPException) {
		XMPPException xmppEx = (XMPPException) e;
		StreamError error = xmppEx.getStreamError();

		// Make sure the error is not null
		if (error != null) {
			String reason = error.getCode();

			if ("conflict".equals(reason)) {
				return;
			}
		}
	}

	if (this.isReconnectionAllowed()) {
		this.reconnect();
	}
}
 
开发者ID:ikantech,项目名称:xmppsupport_v2,代码行数:21,代码来源:ReconnectionManager.java

示例3: connectionClosedOnError

import org.jivesoftware.smack.packet.StreamError; //导入依赖的package包/类
public void connectionClosedOnError(Exception e)
{
	done = false;
	if (e instanceof XMPPException)
	{
		XMPPException xmppEx = (XMPPException) e;
		StreamError error = xmppEx.getStreamError();

		// Make sure the error is not null
		if (error != null)
		{
			String reason = error.getCode();

			if ("conflict".equals(reason))
			{
				return;
			}
		}
	}

	if (this.isReconnectionAllowed())
	{
		this.reconnect();
	}
}
 
开发者ID:jonathangerbaud,项目名称:KlyphMessenger,代码行数:26,代码来源:MessengerService.java

示例4: connectionClosedOnError

import org.jivesoftware.smack.packet.StreamError; //导入依赖的package包/类
public void connectionClosedOnError(Exception ex) {
    handleDisconnect();

    String message = Res.getString("message.disconnected.error");

    if (ex instanceof XMPPException) {
        XMPPException xmppEx = (XMPPException)ex;
        StreamError error = xmppEx.getStreamError();
        String reason = error.getCode();
        if ("conflict".equals(reason)) {
            message = Res.getString("message.disconnected.conflict.error");
        }
    }

    getTranscriptWindow().insertNotificationMessage(message, ChatManager.ERROR_COLOR);
}
 
开发者ID:visit,项目名称:spark-svn-mirror,代码行数:17,代码来源:ChatRoomImpl.java

示例5: parseStreamError

import org.jivesoftware.smack.packet.StreamError; //导入依赖的package包/类
/**
     * Parses stream error packets.
     *
     * @param parser the XML parser.
     * @return an stream error packet.
     * @throws Exception if an exception occurs while parsing the packet.
     */
    public static StreamError parseStreamError(XmlPullParser parser) throws IOException,
            XmlPullParserException {
    final int depth = parser.getDepth();
    boolean done = false;
    String code = null;
    String text = null;
    while (!done) {
        int eventType = parser.next();

        if (eventType == XmlPullParser.START_TAG) {
            String namespace = parser.getNamespace();
            if (StreamError.NAMESPACE.equals(namespace)) {
                String name = parser.getName();
                if (name.equals("text") && !parser.isEmptyElementTag()) {
                    parser.next();
                    text = parser.getText();
                }
                else {
                    // If it's not a text element, that is qualified by the StreamError.NAMESPACE,
                    // then it has to be the stream error code
                    code = name;
                }
            }
        }
        else if (eventType == XmlPullParser.END_TAG && depth == parser.getDepth()) {
            done = true;
        }
    }
    return new StreamError(code, text);
}
 
开发者ID:CJC-ivotten,项目名称:androidPN-client.,代码行数:38,代码来源:PacketParserUtils.java

示例6: parseStreamError

import org.jivesoftware.smack.packet.StreamError; //导入依赖的package包/类
/**
 * Parses stream error packets.
 * 
 * @param doc
 *            the XML parser.
 * @return an stream error packet.
 * @throws Exception
 *             if an exception occurs while parsing the packet.
 */
public static StreamError parseStreamError(Element el) throws IOException,
        XmlPullParserException {
    String code = null;
    Element condEl = (Element) el.elements().iterator().next();
    if (condEl.getNamespace().getURI().equals(StreamError.NAMESPACE)) {
        code = condEl.getName();
    }
    String text = condEl.elementText("text");
    return new StreamError(code, text);
}
 
开发者ID:abmargb,项目名称:jamppa,代码行数:20,代码来源:PacketParserUtils.java

示例7: connectionClosedOnError

import org.jivesoftware.smack.packet.StreamError; //导入依赖的package包/类
public void connectionClosedOnError(final Exception ex) {
String errorMessage = Res.getString("message.disconnected.error");

if (ex != null && ex instanceof XMPPException) {
    XMPPException xmppEx = (XMPPException) ex;
    StreamError error = xmppEx.getStreamError();
    String reason = error.getCode();

    if ("conflict".equals(reason)) {
	errorMessage = Res
		.getString("message.disconnected.conflict.error");
    } else if ("system-shutdown".equals(reason)) {
	errorMessage = Res.getString("message.disconnected.shutdown");
    } else {
	errorMessage = Res.getString("message.general.error", reason);
    }
}

switch (localPreferences.getReconnectPanelType()) {
case 0:
    final String message = errorMessage;
    SwingUtilities.invokeLater(new Runnable() {
	public void run() {
	    _reconnectPanel.setClosedOnError(true);
	    reconnect(message);
	}
    });
    break;
case 1:
    switchAllUserOffline(true);
    _reconnectpanelsmall.setReconnectText(errorMessage);
    break;

case 2:
    switchAllUserOfflineNoGroupEntry(true);
    _reconnectpanelicon.setReconnectText(errorMessage);
    break;

}
   }
 
开发者ID:visit,项目名称:spark-svn-mirror,代码行数:41,代码来源:ContactList.java

示例8: parseStreamError

import org.jivesoftware.smack.packet.StreamError; //导入依赖的package包/类
/**
 * Parses stream error packets.
 *
 * @param parser the XML parser.
 * @return an stream error packet.
 * @throws XmlPullParserException if an exception occurs while parsing the packet.
 * @throws SmackException 
 */
public static StreamError parseStreamError(XmlPullParser parser) throws IOException, XmlPullParserException,
                SmackException {
    final int initialDepth = parser.getDepth();
    List<ExtensionElement> extensions = new ArrayList<ExtensionElement>();
    Map<String, String> descriptiveTexts = null;
    StreamError.Condition condition = null;
    String conditionText = null;
    outerloop: while (true) {
        int eventType = parser.next();
        switch (eventType) {
        case XmlPullParser.START_TAG:
            String name = parser.getName();
            String namespace = parser.getNamespace();
            switch (namespace) {
            case StreamError.NAMESPACE:
                switch (name) {
                case "text":
                    descriptiveTexts = parseDescriptiveTexts(parser, descriptiveTexts);
                    break;
                default:
                    // If it's not a text element, that is qualified by the StreamError.NAMESPACE,
                    // then it has to be the stream error code
                    condition = StreamError.Condition.fromString(name);
                    if (!parser.isEmptyElementTag()) {
                        conditionText = parser.nextText();
                    }
                    break;
                }
                break;
            default:
                PacketParserUtils.addExtensionElement(extensions, parser, name, namespace);
                break;
            }
            break;
        case XmlPullParser.END_TAG:
            if (parser.getDepth() == initialDepth) {
                break outerloop;
            }
            break;
        }
    }
    return new StreamError(condition, conditionText, descriptiveTexts, extensions);
}
 
开发者ID:TTalkIM,项目名称:Smack,代码行数:52,代码来源:PacketParserUtils.java

示例9: StreamErrorException

import org.jivesoftware.smack.packet.StreamError; //导入依赖的package包/类
/**
 * Creates a new XMPPException with the stream error that was the root case of the
 * exception. When a stream error is received from the server then the underlying connection
 * will be closed by the server.
 * 
 * @param streamError the root cause of the exception.
 */
public StreamErrorException(StreamError streamError) {
    super(streamError.getCondition().toString()
          + " You can read more about the meaning of this stream error at http://xmpp.org/rfcs/rfc6120.html#streams-error-conditions\n"
          + streamError.toString());
    this.streamError = streamError;
}
 
开发者ID:TTalkIM,项目名称:Smack,代码行数:14,代码来源:XMPPException.java

示例10: getStreamError

import org.jivesoftware.smack.packet.StreamError; //导入依赖的package包/类
/**
 * Returns the StreamError associated with this exception. The underlying TCP connection is
 * closed by the server after sending the stream error to the client.
 * 
 * @return the StreamError associated with this exception.
 */
public StreamError getStreamError() {
    return streamError;
}
 
开发者ID:TTalkIM,项目名称:Smack,代码行数:10,代码来源:XMPPException.java

示例11: XMPPException

import org.jivesoftware.smack.packet.StreamError; //导入依赖的package包/类
/**
 * Cretaes a new XMPPException with the stream error that was the root case of the
 * exception. When a stream error is received from the server then the underlying
 * TCP connection will be closed by the server.
 *
 * @param streamError the root cause of the exception.
 */
public XMPPException(StreamError streamError) {
    super();
    this.streamError = streamError;
}
 
开发者ID:ice-coffee,项目名称:EIM,代码行数:12,代码来源:XMPPException.java

示例12: getStreamError

import org.jivesoftware.smack.packet.StreamError; //导入依赖的package包/类
/**
 * Returns the StreamError asscociated with this exception, or <tt>null</tt> if there
 * isn't one. The underlying TCP connection is closed by the server after sending the
 * stream error to the client.
 *
 * @return the StreamError asscociated with this exception.
 */
public StreamError getStreamError() {
    return streamError;
}
 
开发者ID:ice-coffee,项目名称:EIM,代码行数:11,代码来源:XMPPException.java

示例13: XMPPException

import org.jivesoftware.smack.packet.StreamError; //导入依赖的package包/类
/**
 * Cretaes a new XMPPException with the stream error that was the root case
 * of the exception. When a stream error is received from the server then
 * the underlying TCP connection will be closed by the server.
 * 
 * @param streamError
 *            the root cause of the exception.
 */
public XMPPException(StreamError streamError) {
	super();
	this.streamError = streamError;
}
 
开发者ID:ikantech,项目名称:xmppsupport_v2,代码行数:13,代码来源:XMPPException.java

示例14: getStreamError

import org.jivesoftware.smack.packet.StreamError; //导入依赖的package包/类
/**
 * Returns the StreamError asscociated with this exception, or <tt>null</tt>
 * if there isn't one. The underlying TCP connection is closed by the server
 * after sending the stream error to the client.
 * 
 * @return the StreamError asscociated with this exception.
 */
public StreamError getStreamError() {
	return streamError;
}
 
开发者ID:ikantech,项目名称:xmppsupport_v2,代码行数:11,代码来源:XMPPException.java

示例15: XMPPException

import org.jivesoftware.smack.packet.StreamError; //导入依赖的package包/类
/**
 * Creates a new XMPPException with the stream error that was the root case
 * of the exception. When a stream error is received from the server then
 * the underlying TCP connection will be closed by the server.
 * 
 * @param streamError
 *            the root cause of the exception.
 */
public XMPPException(StreamError streamError) {
    super();
    this.streamError = streamError;
}
 
开发者ID:abmargb,项目名称:jamppa,代码行数:13,代码来源:XMPPException.java


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