当前位置: 首页>>代码示例>>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;未经允许,请勿转载。