📄 download.java
字号:
import java.io.*;
import java.net.*;
public class DownLoad{
URL url;
String objFile;
long nStartPos;
RandomAccessFile rf;
public DownLoad(String objFile,long nStartPos) throws IOException{
this.nStartPos=nStartPos;
this.objFile=objFile;
rf=new RandomAccessFile(objFile,"rw");
//
rf.seek(nStartPos);
}
public synchronized int write(byte[] b,int nStart,int len){
int n=-1;
try{
rf.write(b,nStart,len);
n=len;
}catch(IOException ioe){
ioe.printStackTrace();
}
return n;
}
public void close()throws IOException{
rf.close();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -