package bianchengti; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; /* * 复制一个文件 */ public class FileCopy { public static void main(String[] args) throws IOException { // TODO Auto-generated method stub FileInputStream fis = new FileInputStream("e:/a.txt"); FileOutputStream fos =new FileOutputStream("e:/b.txt"); byte[] buff = new byte[256]; int len = 0; while((len = fis.read(buff))>0) { fos.write(buff,0,len); } System.out.println("复制完成"); fis.close(); fos.close(); } }
时间: 2024-10-12 04:20:37