⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ibbchunk.java

📁 JBother是纯Java开发的Jabber(即时消息开源软件)客户端。支持群组聊天
💻 JAVA
字号:
/* * IBBChunk.java * * Created on October 4, 2005, 8:36 PM * * To change this template, choose Tools | Template Manager * and open the template in the editor. */package org.jivesoftware.smackx.packet;import org.jivesoftware.smack.packet.*;/** * IBB Data packet * <br> * See <a href="http://www.jabber.org/jeps/jep-0047.html">JEP 047</a> * @author synic */public class IBBChunk implements PacketExtension {    private String sid = "";    private int seq = 0;    private String data = "";        /**     * Returns the namespace for this packet extension     *     * @return the "data" namespace     */    public String getElementName() { return "data"; }        /**     * Returns the namespace for this packet extension     *     * @return "http://jabber.org/protocol/ibb"     */    public String getNamespace() { return "http://jabber.org/protocol/ibb"; }        /**     * Sets the session id for this packet     *@param id The new session id for this packet     */    public void setSid(String id) { sid = id; }        /**     * Returns the session id for this packet     *     * @return The session ID for this packet     */    public String getSid() { return sid; }        /**     * Returns the Base64 encoded data contained in this packet     * @return Base64 encoded data     */    public String getData() { return data; }        /**     * Sets the data to be sent with this packet     *     *@param data   A base64 encoded String representation of the data you want to send     */    public void setData(String data) { this.data = data; }        /**     * Sets the sequence number for this packet.     * Valid numbers are a range between 0 and 65535     *     *@param seq    The sequence number of this packet     *@throws IllegalArgumentException when trying to set an invalid sequence number     */    public void setSeq(int seq) throws IllegalArgumentException {        if(seq < 0 || seq > 65535) {            throw new IllegalArgumentException(            "Valid sequence range is between 0 and 65535"            );        }        this.seq = seq;    }        /**     * Returns the sequence number for this packet     *     *@return the sequence number for this packet     */    public int getSeq() { return seq; }        /**     * Returns the XML representation of this packet     *     *@return the XML representation of this packet     */    public String toXML() {        StringBuffer buff = new StringBuffer();        buff.append("<data xmlns='http://jabber.org/protocol/ibb' ")        .append("sid='").append(sid).append("' ").append("seq='").append(seq)        .append("'>").append(data).append("</data>\n")        .append("<amp xmlns='http://jabber.org/protocol/amp'>\n")        .append("<rule condition='deliver-at' value='stored' action='error' />\n")        .append("<rule condition='match-resource' value='exact' action='error' />\n")        .append("</amp>");                return buff.toString();    }    }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -