Smack

org.jivesoftware.smack.util
Class PacketParserUtils

java.lang.Object
  extended byorg.jivesoftware.smack.util.PacketParserUtils

public class PacketParserUtils
extends Object

Utility class that helps to parse packets. Any parsing packets method that must be shared between many clients must be placed in this utility class.

Author:
Gaston Dombiak

Constructor Summary
PacketParserUtils()
           
 
Method Summary
static XMPPError parseError(org.xmlpull.v1.XmlPullParser parser)
          Parses error sub-packets.
static Packet parseMessage(org.xmlpull.v1.XmlPullParser parser)
          Parses a message packet.
static PacketExtension parsePacketExtension(String elementName, String namespace, org.xmlpull.v1.XmlPullParser parser)
          Parses a packet extension sub-packet.
static Presence parsePresence(org.xmlpull.v1.XmlPullParser parser)
          Parses a presence packet.
static Object parseWithIntrospection(String elementName, Class objectClass, org.xmlpull.v1.XmlPullParser parser)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PacketParserUtils

public PacketParserUtils()
Method Detail

parseMessage

public static Packet parseMessage(org.xmlpull.v1.XmlPullParser parser)
                           throws Exception
Parses a message packet.

Parameters:
parser - the XML parser, positioned at the start of a message packet.
Returns:
a Message packet.
Throws:
Exception - if an exception occurs while parsing the packet.

parsePresence

public static Presence parsePresence(org.xmlpull.v1.XmlPullParser parser)
                              throws Exception
Parses a presence packet.

Parameters:
parser - the XML parser, positioned at the start of a presence packet.
Returns:
a Presence packet.
Throws:
Exception - if an exception occurs while parsing the packet.

parseError

public static XMPPError parseError(org.xmlpull.v1.XmlPullParser parser)
                            throws Exception
Parses error sub-packets.

Parameters:
parser - the XML parser.
Returns:
an error sub-packet.
Throws:
Exception - if an exception occurs while parsing the packet.

parsePacketExtension

public static PacketExtension parsePacketExtension(String elementName,
                                                   String namespace,
                                                   org.xmlpull.v1.XmlPullParser parser)
                                            throws Exception
Parses a packet extension sub-packet.

Parameters:
elementName - the XML element name of the packet extension.
namespace - the XML namespace of the packet extension.
parser - the XML parser, positioned at the starting element of the extension.
Returns:
a PacketExtension.
Throws:
Exception - if a parsing error occurs.

parseWithIntrospection

public static Object parseWithIntrospection(String elementName,
                                            Class objectClass,
                                            org.xmlpull.v1.XmlPullParser parser)
                                     throws Exception
Throws:
Exception

Smack

Copyright © 2003 Jive Software.