當前位置: 首頁>>代碼示例>>Java>>正文


Java Time類代碼示例

本文整理匯總了Java中org.jivesoftware.smackx.time.packet.Time的典型用法代碼示例。如果您正苦於以下問題:Java Time類的具體用法?Java Time怎麽用?Java Time使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Time類屬於org.jivesoftware.smackx.time.packet包,在下文中一共展示了Time類的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: EntityTimeManager

import org.jivesoftware.smackx.time.packet.Time; //導入依賴的package包/類
private EntityTimeManager(XMPPConnection connection) {
    super(connection);
    if (autoEnable)
        enable();

    connection.registerIQRequestHandler(new AbstractIqRequestHandler(Time.ELEMENT, Time.NAMESPACE, Type.get,
                    Mode.async) {
        @Override
        public IQ handleIQRequest(IQ iqRequest) {
            if (enabled) {
                return Time.createResponse(iqRequest);
            }
            else {
                return IQ.createErrorResponse(iqRequest, new XMPPError(Condition.not_acceptable));
            }
        }
    });
}
 
開發者ID:TTalkIM,項目名稱:Smack,代碼行數:19,代碼來源:EntityTimeManager.java

示例2: enable

import org.jivesoftware.smackx.time.packet.Time; //導入依賴的package包/類
public synchronized void enable() {
    if (enabled)
        return;
    ServiceDiscoveryManager sdm = ServiceDiscoveryManager.getInstanceFor(connection());
    sdm.addFeature(Time.NAMESPACE);
    enabled = true;
}
 
開發者ID:TTalkIM,項目名稱:Smack,代碼行數:8,代碼來源:EntityTimeManager.java

示例3: disable

import org.jivesoftware.smackx.time.packet.Time; //導入依賴的package包/類
public synchronized void disable() {
    if (!enabled)
        return;
    ServiceDiscoveryManager sdm = ServiceDiscoveryManager.getInstanceFor(connection());
    sdm.removeFeature(Time.NAMESPACE);
    enabled = false;
}
 
開發者ID:TTalkIM,項目名稱:Smack,代碼行數:8,代碼來源:EntityTimeManager.java

示例4: getTime

import org.jivesoftware.smackx.time.packet.Time; //導入依賴的package包/類
public Time getTime(String jid) throws NoResponseException, XMPPErrorException, NotConnectedException {
    if (!isTimeSupported(jid))
        return null;

    Time request = new Time();
    Time response = (Time) connection().createPacketCollectorAndSend(request).nextResultOrThrow();
    return response;
}
 
開發者ID:TTalkIM,項目名稱:Smack,代碼行數:9,代碼來源:EntityTimeManager.java

示例5: parseTimeWithIntrospectionTest

import org.jivesoftware.smackx.time.packet.Time; //導入依賴的package包/類
@Test
public void parseTimeWithIntrospectionTest() throws Exception {
    // @formatter:off
    final String request =
    "<iq type='get'"
      + "from='[email protected]/orchard'"
      + "to='[email protected]/balcony'"
      + "id='time_1'>"
      + "<time xmlns='urn:xmpp:time'/>"
      + "</iq>";
    // @formatter:on
    IQ iqRequest = (IQ) PacketParserUtils.parseStanza(request);
    assertTrue(iqRequest instanceof Time);

    // @formatter:off
    final String response =
    "<iq type='result'"
      + "from='[email protected]/balcony'"
      + "to='[email protected]/orchard'"
      + "id='time_1'>"
      + "<time xmlns='urn:xmpp:time'>"
      + "<tzo>-06:00</tzo>"
      + "<utc>2006-12-19T17:58:35Z</utc>"
      + "</time>"
      + "</iq>";
    // @formatter:on
    IQ iqResponse = (IQ) PacketParserUtils.parseStanza(response);
    assertTrue(iqResponse instanceof Time);
    Time time = (Time) iqResponse;
    assertEquals("-06:00", time.getTzo());
    assertEquals("2006-12-19T17:58:35Z", time.getUtc());
}
 
開發者ID:TTalkIM,項目名稱:Smack,代碼行數:33,代碼來源:TimeProviderTest.java

示例6: isTimeSupported

import org.jivesoftware.smackx.time.packet.Time; //導入依賴的package包/類
public boolean isTimeSupported(String jid) throws NoResponseException, XMPPErrorException, NotConnectedException  {
    return ServiceDiscoveryManager.getInstanceFor(connection()).supportsFeature(jid, Time.NAMESPACE);
}
 
開發者ID:TTalkIM,項目名稱:Smack,代碼行數:4,代碼來源:EntityTimeManager.java

示例7: TimeProvider

import org.jivesoftware.smackx.time.packet.Time; //導入依賴的package包/類
public TimeProvider() {
    super(Time.class);
}
 
開發者ID:TTalkIM,項目名稱:Smack,代碼行數:4,代碼來源:TimeProvider.java


注:本文中的org.jivesoftware.smackx.time.packet.Time類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。