認識smack中的基本對象-IQ

來源:互聯網
上載者:User

一 IQ類的介紹

IQ繼承自Packet,是Info/Query的縮寫,IQ是最基本的資訊查詢包,它被用於從伺服器擷取資訊,或將資訊設定到伺服器,包括認證、花名冊的操作、建立使用者等。每個IQ包對象都包含一個類型屬性,用於指定改資訊包的操作類型,取值為:get、set、result、error。

 The base IQ (Info/Query) packet. IQ packets are used to get and set information on the server, including authentication, roster operations, and creating accounts. Each IQ packet has a specific type that indicates what type of
action is being taken: "get", "set", "result", or "error".

 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:
•<query xmlns="jabber:iq:auth"> -- an authentication IQ.
•<query xmlns="jabber:iq:private"> -- a private storage IQ.
•<pubsub xmlns="http://jabber.org/protocol/pubsub"> -- a pubsub IQ.

 

 二 IQ類的靜態成員

IQ.Type,其可取的值如下:

  • IQ.Type.GET
  • IQ.Type.SET
  • IQ.Type.RESULT
  • IQ.Type.ERROR

 

二 IQ類的方法

getType
 public IQ.Type getType() Returns the type of the IQ packet.

Returns:the type of the IQ packet.
--------------------------------------------------------------------------------

 

setType
 public void setType(IQ.Type type) Sets the type of the IQ packet.

Parameters:type - the type of the IQ packet.

 

 

 

 

 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.