import java.io.*;
public class CopyFile{
//文件通过节点流复制功能封装为方法
public void copyFile(String srcPath,String destPath){ FileInputStream fis = null; FileOutputStream fos = null; try { //1.创建File类对象 File srcFile = new File(srcPath); File destFile = new File(destPath); //2.创建输入流和输出流对象 fis = new FileInputStream(srcFile); fos = new FileOutputStream(destFile); //3.数据的读入和写出操作 byte[] bytes = new byte[1024]; int len; while((len = fis.read(bytes)) != -1){ fos.write(bytes,0,len); } } catch (IOException e) { e.printStackTrace(); } finally { //4.关闭流资源 try { if(fis != null){ fis.close(); } } catch (IOException e) { e.printStackTrace(); } try { if(fos != null){ fos.clos