public class Version extends IQ
An example to discover the version of the server:
// Request the version from the server.
Version versionRequest = new Version();
timeRequest.setType(IQ.Type.GET);
timeRequest.setTo("example.com");
// Create a packet collector to listen for a response.
PacketCollector collector = con.createPacketCollector(
new PacketIDFilter(versionRequest.getPacketID()));
con.sendPacket(versionRequest);
// Wait up to 5 seconds for a result.
IQ result = (IQ)collector.nextResult(5000);
if (result != null && result.getType() == IQ.Type.RESULT) {
Version versionResult = (Version)result;
// Do something with result...
}| Modifier and Type | Field and Description |
|---|---|
static String |
NAMESPACE |
DEFAULT_LANGUAGE, ID_NOT_AVAILABLE| Constructor and Description |
|---|
Version(String name,
String version,
String os)
Creates a new Version object with given details.
|
Version(Version original) |
| Modifier and Type | Method and Description |
|---|---|
String |
getChildElementXML()
Returns the sub-element XML section of the IQ packet, or null if there
isn't one.
|
String |
getName()
Returns the natural-language name of the software.
|
String |
getOs()
Returns the operating system of the queried entity.
|
String |
getVersion()
Returns the specific version of the software.
|
void |
setName(String name)
Sets the natural-language name of the software.
|
void |
setOs(String os)
Sets the operating system of the queried entity.
|
void |
setVersion(String version)
Sets the specific version of the software.
|
createErrorResponse, createResultIQ, getType, setType, toXMLaddCommonAttributes, addExtension, addExtensions, equals, getDefaultLanguage, getError, getExtension, getExtension, getExtensions, getExtensionsXML, getFrom, getPacketID, getTo, getXmlns, hashCode, nextID, removeExtension, setDefaultXmlns, setError, setFrom, setPacketID, setTo, toStringpublic static final String NAMESPACE
public Version(String name, String version, String os)
name - The natural-language name of the software. This element is REQUIRED.version - The specific version of the software. This element is REQUIRED.os - The operating system of the queried entity. This element is OPTIONAL.public String getName()
public void setName(String name)
name - the natural-language name of the software.public String getVersion()
public void setVersion(String version)
version - the specific version of the software.public String getOs()
public void setOs(String os)
os - operating system of the queried entity.public String getChildElementXML()
IQExtensions of this class must override this method.
getChildElementXML in class IQ