当前位置: 首页>>代码示例>>Java>>正文


Java XmppDateTime类代码示例

本文整理汇总了Java中org.jxmpp.util.XmppDateTime的典型用法代码示例。如果您正苦于以下问题:Java XmppDateTime类的具体用法?Java XmppDateTime怎么用?Java XmppDateTime使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


XmppDateTime类属于org.jxmpp.util包,在下文中一共展示了XmppDateTime类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: parse

import org.jxmpp.util.XmppDateTime; //导入依赖的package包/类
@Override
public PostEntryExtension parse(XmlPullParser parser, int initialDepth) throws Exception {
    String title = null;
    String id = null;
    Date published = null;
    Date updated = null;

    outerloop:
    while (true) {
        int eventType = parser.next();

        if (eventType == XmlPullParser.START_TAG) {

            if (parser.getName().equals("title")) {
                title = parser.nextText();
            }

            if (parser.getName().equals("id")) {
                id = parser.nextText().split("posts-")[1];
            }

            if (parser.getName().equals("published")) {
                published = XmppDateTime.parseXEP0082Date(parser.nextText());
            }

            if (parser.getName().equals("updated")) {
                updated = XmppDateTime.parseXEP0082Date(parser.nextText());
            }

        } else if (eventType == XmlPullParser.END_TAG) {
            if (parser.getDepth() == initialDepth) {
                break outerloop;
            }
        }

    }

    return new PostEntryExtension(title, id, published, updated);
}
 
开发者ID:esl,项目名称:mangosta-android,代码行数:40,代码来源:PostEntryProvider.java

示例2: toXML

import org.jxmpp.util.XmppDateTime; //导入依赖的package包/类
public XmlStringBuilder toXML() {
    XmlStringBuilder xml = new XmlStringBuilder(this);
    xml.optIntAttribute("maxchars", getMaxChars());
    xml.optIntAttribute("maxstanzas", getMaxStanzas());
    xml.optIntAttribute("seconds", getSeconds());
    if (getSince() != null) {
        xml.attribute("since", XmppDateTime.formatXEP0082Date(getSince()));
    }
    xml.closeEmptyElement();
    return xml;
}
 
开发者ID:TTalkIM,项目名称:Smack,代码行数:12,代码来源:MUCInitialPresence.java

示例3: getExpiry

import org.jxmpp.util.XmppDateTime; //导入依赖的package包/类
/**
 * Get the time at which the leased subscription will expire, or has expired.
 * 
 * @return The expiry date
 */
public Date getExpiry()
{
	String dateTime = getFieldValue(SubscribeOptionFields.expire);
	try
	{
		return XmppDateTime.parseDate(dateTime);
	}
	catch (ParseException e)
	{
		UnknownFormatConversionException exc = new UnknownFormatConversionException(dateTime);
		exc.initCause(e);
		throw exc;
	}
}
 
开发者ID:TTalkIM,项目名称:Smack,代码行数:20,代码来源:SubscribeForm.java

示例4: Time

import org.jxmpp.util.XmppDateTime; //导入依赖的package包/类
/**
 * Creates a new Time instance using the specified calendar instance as
 * the time value to send.
 *
 * @param cal the time value.
 */
public Time(Calendar cal) {
    super(ELEMENT, NAMESPACE);
    tzo = XmppDateTime.asString(cal.getTimeZone());
    // Convert local time to the UTC time.
    utc = XmppDateTime.formatXEP0082Date(cal.getTime());
}
 
开发者ID:TTalkIM,项目名称:Smack,代码行数:13,代码来源:Time.java

示例5: getTime

import org.jxmpp.util.XmppDateTime; //导入依赖的package包/类
/**
 * Returns the local time or <tt>null</tt> if the time hasn't been set.
 *
 * @return the local time.
 */
public Date getTime() {
    if (utc == null) {
        return null;
    }
    Date date = null;
    try {
        date = XmppDateTime.parseDate(utc);
    }
    catch (Exception e) {
        LOGGER.log(Level.SEVERE, "Error getting local time", e);
    }
    return date;
}
 
开发者ID:TTalkIM,项目名称:Smack,代码行数:19,代码来源:Time.java

示例6: toXML

import org.jxmpp.util.XmppDateTime; //导入依赖的package包/类
@Override
public XmlStringBuilder toXML() {
    XmlStringBuilder xml = new XmlStringBuilder(this);
    xml.attribute("stamp", XmppDateTime.formatXEP0082Date(stamp));
    xml.optAttribute("from", from);
    xml.rightAngleBracket();
    xml.optAppend(reason);
    xml.closeElement(this);
    return xml;
}
 
开发者ID:TTalkIM,项目名称:Smack,代码行数:11,代码来源:DelayInformation.java

示例7: toXML

import org.jxmpp.util.XmppDateTime; //导入依赖的package包/类
public String toXML() {
    StringBuilder buffer = new StringBuilder();

    buffer.append("<").append(getElementName()).append(" xmlns=\"")
            .append(getNamespace()).append("\" ");

    if (getName() != null) {
        buffer.append("name=\"").append(StringUtils.escapeForXML(getName())).append("\" ");
    }

    if (getSize() > 0) {
        buffer.append("size=\"").append(getSize()).append("\" ");
    }

    if (getDate() != null) {
        buffer.append("date=\"").append(XmppDateTime.formatXEP0082Date(date)).append("\" ");
    }

    if (getHash() != null) {
        buffer.append("hash=\"").append(getHash()).append("\" ");
    }

    if ((desc != null && desc.length() > 0) || isRanged) {
        buffer.append(">");
        if (getDesc() != null && desc.length() > 0) {
            buffer.append("<desc>").append(StringUtils.escapeForXML(getDesc())).append("</desc>");
        }
        if (isRanged()) {
            buffer.append("<range/>");
        }
        buffer.append("</").append(getElementName()).append(">");
    }
    else {
        buffer.append("/>");
    }
    return buffer.toString();
}
 
开发者ID:TTalkIM,项目名称:Smack,代码行数:38,代码来源:StreamInitiation.java

示例8: validatePresenceWithDelayedDelivery

import org.jxmpp.util.XmppDateTime; //导入依赖的package包/类
@Test
public void validatePresenceWithDelayedDelivery() throws Exception {
    String stanza = "<presence from='[email protected]' to='[email protected]'>"
            + "<delay xmlns='urn:xmpp:delay' stamp='2002-09-10T23:41:07Z'/></presence>";

    Presence presence = PacketParserUtils.parsePresence(PacketParserUtils.getParserFor(stanza));
    
    DelayInformation delay = DelayInformationManager.getXep203DelayInformation(presence);
    assertNotNull(delay);
    Date date = XmppDateTime.parseDate("2002-09-10T23:41:07Z");
    assertEquals(date, delay.getStamp());
}
 
开发者ID:TTalkIM,项目名称:Smack,代码行数:13,代码来源:DelayInformationTest.java

示例9: setDateLastTokenUpdate

import org.jxmpp.util.XmppDateTime; //导入依赖的package包/类
private void setDateLastTokenUpdate(Date date) {
    final SharedPreferences.Editor editor = mPreferences.edit();
    editor.putString(DATE_LAST_TOKEN_UPDATE, XmppDateTime.formatXEP0082Date(date));
    editor.apply();
}
 
开发者ID:esl,项目名称:mangosta-android,代码行数:6,代码来源:Preferences.java

示例10: tokenSetMinutesAgo

import org.jxmpp.util.XmppDateTime; //导入依赖的package包/类
private boolean tokenSetMinutesAgo(int minutes) throws ParseException {
    return TimeCalculation.wasMinutesAgoMax(XmppDateTime.parseXEP0082Date(Preferences.getInstance().getDateLastTokenUpdate()), minutes);
}
 
开发者ID:esl,项目名称:mangosta-android,代码行数:4,代码来源:XMPPSession.java

示例11: setExpiry

import org.jxmpp.util.XmppDateTime; //导入依赖的package包/类
/**
 * Sets the time at which the leased subscription will expire, or has expired.
 * 
 * @param expire The expiry date
 */
public void setExpiry(Date expire)
{
	addField(SubscribeOptionFields.expire, FormField.Type.text_single);
	setAnswer(SubscribeOptionFields.expire.getFieldName(), XmppDateTime.formatXEP0082Date(expire));
}
 
开发者ID:TTalkIM,项目名称:Smack,代码行数:11,代码来源:SubscribeForm.java

示例12: AMPExpireAtCondition

import org.jxmpp.util.XmppDateTime; //导入依赖的package包/类
/**
 * Create new expire-at amp condition with value setted as XEP-0082 formatted date.
 * @param utcDateTime Date instance of time
 *                    that will be used as value parameter after formatting to XEP-0082 format. Can't be null.
 */
public AMPExpireAtCondition(Date utcDateTime) {
    if (utcDateTime == null)
        throw new NullPointerException("Can't create AMPExpireAtCondition with null value");
    this.value = XmppDateTime.formatXEP0082Date(utcDateTime);
}
 
开发者ID:TTalkIM,项目名称:Smack,代码行数:11,代码来源:AMPExpireAtCondition.java

示例13: parseDate

import org.jxmpp.util.XmppDateTime; //导入依赖的package包/类
@Override
protected Date parseDate(String string) throws ParseException {
    return XmppDateTime.parseXEP0082Date(string);
}
 
开发者ID:TTalkIM,项目名称:Smack,代码行数:5,代码来源:DelayInformationProvider.java

示例14: parseDate

import org.jxmpp.util.XmppDateTime; //导入依赖的package包/类
@Override
protected Date parseDate(String string) throws ParseException {
    return XmppDateTime.parseDate(string);
}
 
开发者ID:TTalkIM,项目名称:Smack,代码行数:5,代码来源:LegacyDelayInformationProvider.java


注:本文中的org.jxmpp.util.XmppDateTime类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。