JML

net.sf.jqql.packets.in.disk
Class DiskInPacketFragment

java.lang.Object
  extended by net.sf.jqql.packets.Packet
      extended by net.sf.jqql.packets.InPacket
          extended by net.sf.jqql.packets.DiskInPacket
              extended by net.sf.jqql.packets.in.disk.DiskInPacketFragment

public class DiskInPacketFragment
extends DiskInPacket

 network protocol packet fragment is a part of a packet. Packet of network protocol family may be very big, 
 and the default buffer is as small as QQ.QQ_MAX_PACKET_SIZE. So it's a problem to parse the too big packet.
 Thus, the too big packet is divided into fragment. General speaking, packet fragment is part of packet body. For the 
 packet fragment has not packet head,  the parse must carry on task to set packet command and so on.

 网络协议族包片断。包片断只是某个包的一部分,由于网络协议族的包可能非常大,而缺省的缓冲区
 只有QQ.QQ_MAX_PACKET_SIZE大,所以解析这样超大的包成了一个问题。所以会把某些超大的包
 拆成包片断处理。通常来说,包片断是包体的一部分。由于包片断没有包头,所以解析器必须担负起
 设置包命令等字段的任务。
 

Author:
luma

Field Summary
 byte[] body
           
 
Fields inherited from class net.sf.jqql.packets.DiskInPacket
replyCode, replyMessage
 
Fields inherited from class net.sf.jqql.packets.Packet
bodyBuf, bodyDecrypted, command, crypter, ds, duplicated, header, log, sequence, source, user
 
Constructor Summary
DiskInPacketFragment(ByteBuffer buf, int length, QQUser user)
           
 
Method Summary
protected  byte[] getBodyBytes(ByteBuffer buf, int length)
          get byte array of packet body 得到包体的字节数组
protected  void parseBody(ByteBuffer buf)
          parse packet body, from begin position of buf 解析包体,从buf的开头位置解析起
protected  void parseHeader(ByteBuffer buf)
          parse packet header from current position of buf 从buf的当前位置解析包头
protected  void parseTail(ByteBuffer buf)
          parse packet tail from current position of buf 从buf的当前未知解析包尾
protected  void putBody(ByteBuffer buf)
          initialize packet body 初始化包体
protected  void putHead(ByteBuffer buf)
          change packet header to byte stream, and write into appointed ByteBuffer object.
protected  void putTail(ByteBuffer buf)
          change packet tail to byte stream, and write into appointed ByteBuffer object.
 
Methods inherited from class net.sf.jqql.packets.DiskInPacket
decryptBody, encryptBody, equals, getCryptographStart, getFamily, getHeadLength, getLength, getTailLength, hashCode
 
Methods inherited from class net.sf.jqql.packets.InPacket
validateHeader
 
Methods inherited from class net.sf.jqql.packets.Packet
dump, getCommand, getHeader, getPacketName, getSequence, getSource, hash, isDuplicated, setDuplicated, setHeader, setSequence
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

body

public byte[] body
Constructor Detail

DiskInPacketFragment

public DiskInPacketFragment(ByteBuffer buf,
                            int length,
                            QQUser user)
                     throws PacketParseException
Throws:
PacketParseException
Method Detail

parseBody

protected void parseBody(ByteBuffer buf)
                  throws PacketParseException
Description copied from class: Packet
parse packet body, from begin position of buf 解析包体,从buf的开头位置解析起

Specified by:
parseBody in class Packet
Parameters:
buf - ByteBuffer
Throws:
PacketParseException - if parse error 如果解析出错

getBodyBytes

protected byte[] getBodyBytes(ByteBuffer buf,
                              int length)
Description copied from class: Packet
get byte array of packet body 得到包体的字节数组

Overrides:
getBodyBytes in class DiskInPacket
Parameters:
buf - ByteBuffer
length - packet total length 包总长度
Returns:
byte array of packet body 包体字节数组

parseHeader

protected void parseHeader(ByteBuffer buf)
                    throws PacketParseException
Description copied from class: Packet
parse packet header from current position of buf 从buf的当前位置解析包头

Overrides:
parseHeader in class DiskInPacket
Parameters:
buf - ByteBuffer
Throws:
PacketParseException - if parse error 如果解析出错

parseTail

protected void parseTail(ByteBuffer buf)
                  throws PacketParseException
Description copied from class: Packet
parse packet tail from current position of buf 从buf的当前未知解析包尾

Overrides:
parseTail in class DiskInPacket
Parameters:
buf - ByteBuffer
Throws:
PacketParseException - if parse error 如果解析出错

putHead

protected void putHead(ByteBuffer buf)
Description copied from class: Packet
change packet header to byte stream, and write into appointed ByteBuffer object. 将包头部转化为字节流, 写入指定的ByteBuffer对象.

Overrides:
putHead in class DiskInPacket
Parameters:
buf - ByteBuffer object whicn packet need to write into 写入的ByteBuffer对象.

putTail

protected void putTail(ByteBuffer buf)
Description copied from class: Packet
change packet tail to byte stream, and write into appointed ByteBuffer object. 将包尾部转化为字节流, 写入指定的ByteBuffer对象.

Overrides:
putTail in class DiskInPacket
Parameters:
buf - ByteBuffer object whicn packet need to write into 写入的ByteBuffer对象.

putBody

protected void putBody(ByteBuffer buf)
Description copied from class: Packet
initialize packet body 初始化包体

Overrides:
putBody in class DiskInPacket
Parameters:
buf - ByteBuffer

JML