tbdl.java

来自「java实现的ftp文件传输」· Java 代码 · 共 38 行

JAVA
38
字号
import java.io.BufferedInputStream;
import java.io.IOException;
import org.apache.commons.net.ftp.FTPClient;

public class TBdl extends Thread{
	FTPClient ftpdl;
	WByte wbyte;
	BufferedInputStream bindl;
	String path;
	TBdl(WByte wbyte,BufferedInputStream bindl,FTPClient ftpdl) throws IOException{
		this.wbyte = wbyte;
//		this.path = path;
		this.ftpdl = ftpdl;
		this.bindl = bindl;
	}

//	下载一个缓冲区的数据
	public void run(){
		try{
			wbyte.flag_busy = 1;
			wbyte.length = bindl.read(wbyte.buf,0,wbyte.bufsize);
			wbyte.flag_empty = 0;
			if(wbyte.length == -1){
				wbyte.flag_over = 1;
			}
			wbyte.flag_busy = 0;
		}catch(Exception e){
			System.out.println("error occur when download.");
		}
			
//	 	try{
//	 		findl.close();
//	 		bindl.close();
//	 	}catch(Exception e){
//	 		System.out.println("error occur when close stream in download");
//	 	}
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?