62,614
社区成员
发帖
与我相关
我的任务
分享
FileChannel fc = ...; FileChannel sc = ...;
long pos = ... ; long len = ... ;
final long MAX_SIZE = 1<<19;//512K个字节
long curPos = pos;
while(curPos+MAX_SIZE<pos+len){
sc.transferTo(fc,curPos,MAX_SIZE);
curPos += MAX_SIZE;
}
sc.transferTo(fc,curPos,pos+len-curPos);