本文整理汇总了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();
}
}
示例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();
}
}
示例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();
}
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}