import java.io.*;
class Test
{
public static void main(String args[]){
FileInputStream fin =null;
FileOutputStream fout = null;
try{
fin = new FileInputStream("e://d/from.txt");
fout = new FileOutputStream("e://d/to.txt");
byte [] arr =new byte[1024];
while(true){
int temp = fin.read(arr,0,arr.length);
if(temp == -1){ //读取到末端返回-1
break;
}
fout.write(arr,0,temp);
}
}catch(Exception e){
System.out.println(e);
}
finally{ //关掉流
try{
fout.close();
fin.close();
}catch(Exception e){
System.out.println(e);
}
}
}
}