package dadeo.filecopy;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
public class filecopy {
public static void main(String[] args) {
String filepath="d:\\hello.txt";
String destpath="d:\\hello5.txt";
FileOutputStream fileOutputStream=null;
FileInputStream fileInputStream=null;
try {
fileInputStream =new FileInputStream(filepath);
fileOutputStream=new FileOutputStream(destpath);
byte [] buf=new byte[1024];
int readlen=0;
while ((readlen=fileInputStream.read(buf))!=-1){
fileOutputStream.write(buf,0,readlen);
}
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
if(fileInputStream!=null){
fileInputStream.close();
}
if(fileOutputStream!=null){
fileOutputStream.close();
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
08-06
197
11-21
314