JML

net.sf.jqql.obsolete
Class FragmentBuffer

java.lang.Object
  extended by net.sf.jqql.obsolete.FragmentBuffer

public class FragmentBuffer
extends Object

 use to save buffer which send file data, its size and window is same, file fragment sequence begin from 1
 if user request get a fragment overflow current area, nothing to do.
 用于保存发送文件数据的缓冲区,它的尺寸和滑窗相同,文件分片序号从1开始
 如果用户请求得到一个不在当前范围内的分片,则不做处理
 

Author:
luma

Constructor Summary
FragmentBuffer(RandomAccessFile file, int size, int fz, int max)
          constructed function 构造函数
 
Method Summary
 byte[] getFragment(int index)
          get a fragment array 得到一个分片的数组
 void release(int num)
          release num count fragment in front 抛弃最前面的num个分片
 void releaseTo(int index)
          release all fragment from low to index( include), rectify low and high value and import a new fragment 抛弃从low到index(包括)为止的所有分片,调整lowå’Œhigh的值并载入新的分片
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FragmentBuffer

public FragmentBuffer(RandomAccessFile file,
                      int size,
                      int fz,
                      int max)
constructed function 构造函数

Parameters:
file - RandomAccessFile对象 // RandomAccessFile object
size - buffer大小 // buffer size
fz - 分片大小 // fragment size
max - 文件最大的分片序号 // most fragment sequence number of file
Method Detail

getFragment

public byte[] getFragment(int index)
get a fragment array 得到一个分片的数组

Parameters:
index - 分片的绝对序号 // fragment absolute sequence number
Returns:
分片数据字节数组 // fragment data byte array

releaseTo

public void releaseTo(int index)
release all fragment from low to index( include), rectify low and high value and import a new fragment 抛弃从low到index(包括)为止的所有分片,调整low和high的值并载入新的分片

Parameters:
index - 分片的绝对序号 // fragment absolute sequence number

release

public void release(int num)
release num count fragment in front 抛弃最前面的num个分片

Parameters:
num -

JML