|
JML | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
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 Packet
buf
- 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 Packet
protected static char getNextSeq()
public String getPacketName()
getPacketName
in class Packet
public 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 All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |