public class FileEach { public static void main(String[] args){ try { FileInputStream fis = new FileInputStream("C:\a.html");//输入流 FileOutputStream fos = new FileOutputStream("C:\a_bak.html");//输入流
//模版代码 int len = 0; byte[] buffer = new byte[1024]; while((len = fis.read(buffer)) > 0){ fos.write(buffer, 0, len); } fis.close(); fos.flush(); fos.close(); System.out.println("ok"); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } }