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

📄 msnemoticonmessage.java

📁 封装的msn代码,利用他很容易就可以登录msn.实现和msn通讯的目的.
💻 JAVA
字号:
package net.sf.jml.message;import java.nio.ByteBuffer;import java.util.HashMap;import java.util.Map;import net.sf.cindy.util.ByteBufferUtils;import net.sf.jml.MsnObject;import net.sf.jml.message.p2p.DisplayPictureDuelManager;import net.sf.jml.util.Charset;import net.sf.jml.util.JmlConstants;public class MsnEmoticonMessage extends MsnMimeMessage {    public static final String EMOTICON_SEPARATOR = "\t";    private Map<String, MsnObject> emoticons;    public MsnEmoticonMessage() {        setContentType(MessageConstants.CT_EMOTICON);        emoticons = new HashMap<String, MsnObject>(5);    }    public void putEmoticon(String shortcut, MsnObject emoticon) {        emoticons.put(shortcut,emoticon);        if (emoticon != null){            DisplayPictureDuelManager.getDuelManager().putPicture(                    emoticon.toString(), emoticon);        }    }    @Override	protected void parseMessage(byte[] message) {       ByteBuffer split = Charset.encode(JmlConstants.LINE_SEPARATOR                                         + JmlConstants.LINE_SEPARATOR);       int pos = ByteBufferUtils.indexOf(ByteBuffer.wrap(message), split);       //header       String header = pos == -1 ? Charset.decode(message) : Charset.decode(               message, 0, pos);       headers.parseString(header);       //body       pos += split.remaining();       ByteBuffer body = ByteBuffer.allocate(message.length - pos);       body.put(message, pos,                        message.length - pos);       body.flip();   }   @Override   public String toString() {       StringBuffer ret = new StringBuffer();       for (Map.Entry<String, MsnObject> entry : emoticons.entrySet()) {           ret.append(entry.getKey());           ret.append(EMOTICON_SEPARATOR);           ret.append(entry.getValue());           ret.append(EMOTICON_SEPARATOR);       }       return super.toString() + ret.toString();   }}

⌨️ 快捷键说明

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