copyfile.java
来自「包括了许多源码,多线程,不用第三方变量交换变量值等源码」· Java 代码 · 共 47 行
JAVA
47 行
import java.io.*;
public class copyfile {
/**
* @param args
*/
String file1,file2;
public copyfile(String file1,String file2){
this.file1=file1;
this.file2=file2;
}
public void copyf(){
try{
InputStream input=new FileInputStream(file1);
OutputStream output=new FileOutputStream(file2);
byte[] b=new byte[1024];
while(input.read(b)!= -1){
output.write(b);
}
}
catch(Exception e){
System.out.println(e.getMessage());
}
}
public static void main(String[] args) {
// TODO Auto-generated method stub
copyfile cf1=new copyfile("c:\\1.pdf","d:\\1.pdf");
new th(cf1).start();
copyfile cf2=new copyfile("c:\\1.pdf","d:\\2.pdf");
new th(cf2).start();
copyfile cf3=new copyfile("c:\\1.pdf","d:\\3.pdf");
new th(cf3).start();
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?