?? getfriendlistreplypacket.java
字號:
/*
* LumaQQ - Java QQ Client
*
* Copyright (C) 2004 luma <stubma@163.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package edu.tsinghua.lumaqq.qq.packets.in;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.List;
import edu.tsinghua.lumaqq.qq.PacketParseException;
import edu.tsinghua.lumaqq.qq.beans.QQFriend;
import edu.tsinghua.lumaqq.qq.packets.InPacket;
/**
* <pre>
* 請求好友列表的應答包,格式為
* 1. 頭部
* 2. 好友列表開始位置,這個位置是你所有好友排序后的位置,如果為0xFFFF,那就是你的好友已經全部得到了
* 每次都固定的返回50個好友,所以如果不足50個了,那么這個值一定是0xFFFF了
* 3. 好友QQ號,4字節
* 4. 1字節,如果好友就是自己,為0xFF,否則為0x00
* 5. 頭像,1字節
* 6. 年齡,1字節
* 7. 性別,1字節
* 8. 昵稱長度,1字節
* 9. 昵稱,不定字節,由8指定
* 10. 2個未知字節
* 11. 1字節擴展標志,bit1表示是否有QQ Show,其他未知
* 12. 1字節通用標志
* bit1 => 會員
* bit4 => TCP方式登陸
* bit5 => 開發移動QQ
* bit6 => 綁定到手機
* bit7 => 是否有攝像頭
* 13. 重復3到12的結構
* 14.尾部
* </pre>
*
* @author 馬若劼
*/
public class GetFriendListReplyPacket extends InPacket {
public char position;
public List friends;
/**
* 構造函數
* @param buf 緩沖區
* @param length 包長度
* @throws PacketParseException 解析錯誤
*/
public GetFriendListReplyPacket(ByteBuffer buf, int length) throws PacketParseException {
super(buf, length);
}
/* (non-Javadoc)
* @see edu.tsinghua.lumaqq.qq.packets.InPacket#parseBody(java.nio.ByteBuffer)
*/
protected void parseBody(ByteBuffer buf) throws PacketParseException {
// 當前好友列表位置
position = buf.getChar();
// 只要還有數據就繼續讀取下一個friend結構
friends = new ArrayList();
while(buf.hasRemaining()) {
QQFriend friend = new QQFriend();
friend.readBean(buf);
// 添加到list
friends.add(friend);
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -