public abstract class IQ extends Packet
IQ packets can contain a single child element that exists in a specific XML namespace. The combination of the element name and namespace determines what type of IQ packet it is. Some example IQ subpacket snippets:
| Modifier and Type | Class and Description |
|---|---|
static class |
IQ.Type
A enum to represent the type of the IQ packet.
|
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
ELEMENT |
static java.lang.String |
QUERY_ELEMENT |
DEFAULT_LANGUAGE, ITEM, TEXT| Modifier and Type | Method and Description |
|---|---|
static IQ |
createErrorResponse(IQ request,
XMPPError error)
|
static IQ |
createResultIQ(IQ request)
Convenience method to create a new empty
IQ.Type.result
IQ based on a IQ.Type.get or IQ.Type.set
IQ. |
abstract java.lang.CharSequence |
getChildElementXML()
Returns the sub-element XML section of the IQ packet, or null if there
isn't one.
|
IQ.Type |
getType()
Returns the type of the IQ packet.
|
void |
setType(IQ.Type type)
Sets the type of the IQ packet.
|
java.lang.CharSequence |
toXML()
Returns the XML representation of this Element.
|
addCommonAttributes, addExtension, addExtensions, equals, getDefaultLanguage, getError, getExtension, getExtension, getExtensions, getExtensionsXML, getFrom, getPacketID, getTo, hashCode, removeExtension, setError, setFrom, setPacketID, setTo, toStringpublic static final java.lang.String ELEMENT
public static final java.lang.String QUERY_ELEMENT
public IQ()
public IQ(IQ iq)
public IQ.Type getType()
public void setType(IQ.Type type)
type - the type of the IQ packet.public java.lang.CharSequence toXML()
Elementpublic abstract java.lang.CharSequence getChildElementXML()
Extensions of this class must override this method.
public static IQ createResultIQ(IQ request)
IQ.Type.result
IQ based on a IQ.Type.get or IQ.Type.set
IQ. The new packet will be initialized with:IQ.Type.result.
request - the IQ.Type.get or IQ.Type.set IQ packet.IQ.Type.result IQ based on the originating IQ.java.lang.IllegalArgumentException - if the IQ packet does not have a type of
IQ.Type.get or IQ.Type.set.public static IQ createErrorResponse(IQ request, XMPPError error)
IQ.Type.error IQ
based on a IQ.Type.get or IQ.Type.set
IQ. The new packet will be initialized with:IQ.Type.error.
XMPPError.
request - the IQ.Type.get or IQ.Type.set IQ packet.error - the error to associate with the created IQ packet.IQ.Type.error IQ based on the originating IQ.java.lang.IllegalArgumentException - if the IQ packet does not have a type of
IQ.Type.get or IQ.Type.set.