public void CopyFile(String FilePath,String outFilePath){
try {
FileInputStream fi = new FileInputStream(FilePath);
BufferedInputStream in = new BufferedInputStream(fi);
FileOutputStream fo = new FileOutputStream(outFilePath);
BufferedOutputStream out = new BufferedOutputStream(fo);
byte[] buf = new byte[1024];
int len = in.read(buf);// 读文件,将读到的内容放入到buf数组中,返回的是读到的长度
while (len != -1) {
out.write(buf, 0, len);
len = in.read(buf);
}
out.close();
fo.close();
in.close();
fi.close();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}