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 class to represent the type of the IQ packet.
|
DEFAULT_LANGUAGE, ID_NOT_AVAILABLE
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 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.
|
CharSequence |
toXML()
Returns the packet as XML.
|
addCommonAttributes, addExtension, addExtensions, equals, getDefaultLanguage, getError, getExtension, getExtension, getExtensions, getExtensionsXML, getFrom, getPacketID, getTo, getXmlns, hashCode, nextID, removeExtension, setDefaultXmlns, setError, setFrom, setPacketID, setTo, toString
public IQ.Type getType()
public void setType(IQ.Type type)
type
- the type of the IQ packet.public CharSequence toXML()
Packet
public abstract 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.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.IllegalArgumentException
- if the IQ packet does not have a type of
IQ.Type.GET
or IQ.Type.SET
.