|
JML | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.sf.jqql.packets.Packet
net.sf.jqql.packets.OutPacket
public abstract class OutPacket
所有输出包基类,这个基类定义了输出包的基本框架
| Field Summary | |
|---|---|
protected boolean |
ack
是否需要回应 |
protected byte[] |
key
加密/解密密钥,只有有些包可能需要一个特定的密钥,如果为null,使用缺省的 |
protected int |
resendCountDown
重发计数器 |
protected int |
sendCount
发送次数,只在包是不需要ack时有效,比如logout包是发4次,但是其他可能只发一次 |
protected static char |
seq
包起始序列号 |
protected long |
timeout
超时截止时间,单位ms |
| Fields inherited from class net.sf.jqql.packets.Packet |
|---|
bodyBuf, bodyDecrypted, command, crypter, ds, duplicated, header, log, sequence, source, user |
| Constructor Summary | |
|---|---|
protected |
OutPacket(ByteBuffer buf,
int length,
QQUser user)
create a outPacket from buf, use to debug. |
protected |
OutPacket(ByteBuffer buf,
QQUser user)
create a outPacket from buf, use to debug. |
|
OutPacket(byte header,
char command,
boolean ack,
QQUser user)
create a basic output packet 创建一个基本输出包 |
| Method Summary | |
|---|---|
byte[] |
dump()
export all content of packet to a byte array, mostly use to debug 导出包的全部内容到一个字节数组中,主要用于调试 |
void |
fill(ByteBuffer buf)
change whole packet to byte stream, and write into appointed ByteBuffer object. |
byte[] |
getKey()
|
protected static char |
getNextSeq()
|
String |
getPacketName()
|
int |
getSendCount()
|
long |
getTimeout()
|
boolean |
needAck()
|
boolean |
needResend()
whether need resend. |
protected void |
parseBody(ByteBuffer buf)
parse packet body, from begin position of buf 解析包体,从buf的开头位置解析起 |
protected abstract void |
postFill(ByteBuffer buf,
int startPos)
backfill, some field must fill whole packet to make sure its content, for example length field, then this method will be used after tail filling. |
void |
setKey(byte[] key)
|
void |
setSendCount(int sendCount)
|
void |
setTimeout(long timeout)
|
| Methods inherited from class net.sf.jqql.packets.Packet |
|---|
decryptBody, encryptBody, equals, getBodyBytes, getCommand, getCryptographStart, getFamily, getHeader, getHeadLength, getLength, getSequence, getSource, getTailLength, hash, hashCode, isDuplicated, parseHeader, parseTail, putBody, putHead, putTail, setDuplicated, setHeader, setSequence, validateHeader |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static char seq
protected boolean ack
protected int resendCountDown
protected long timeout
protected int sendCount
protected byte[] key
| Constructor Detail |
|---|
public OutPacket(byte header,
char command,
boolean ack,
QQUser user)
command - packet command
包命令ack - whether packet needs reply
包是否需要回复user - QQ user object
QQ用户对象
protected OutPacket(ByteBuffer buf,
QQUser user)
throws PacketParseException
buf - ByteBuffer
PacketParseException - parse error
解析出错
protected OutPacket(ByteBuffer buf,
int length,
QQUser user)
throws PacketParseException
buf - ByteBufferlength - parsing content length
要解析的内容长度
PacketParseException - if parse error
如果解析出错| Method Detail |
|---|
protected void parseBody(ByteBuffer buf)
throws PacketParseException
Packet
parseBody in class Packetbuf - ByteBuffer
PacketParseException - if parse error
如果解析出错
protected abstract void postFill(ByteBuffer buf,
int startPos)
buf - ByteBufferstartPos - packet initial position
包起始位置public void fill(ByteBuffer buf)
buf - ByteBuffer object whicn packet need to write into
将包写入的ByteBuffer对象.public byte[] dump()
Packet
dump in class Packetprotected static char getNextSeq()
public String getPacketName()
getPacketName in class Packetpublic final boolean needResend()
public final boolean needAck()
public final long getTimeout()
public final void setTimeout(long timeout)
timeout - The timeout to set.public final void setSendCount(int sendCount)
sendCount - The sendCount to set.public final int getSendCount()
public byte[] getKey()
public void setKey(byte[] key)
key - The key to set.
|
JML | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||