赞
踩
//BufferedInputStream BufferedOutputStream类(实现文件的复制) package work; import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.FileInputStream; import java.io.FileOutputStream; public class stream { public static void main(String[] args) { BufferedInputStream br = null; BufferedOutputStream bm = null; try { br = new BufferedInputStream(new FileInputStream("H:\\a.txt")); bm = new BufferedOutputStream(new FileOutputStream("H:\\log.txt")); int l = 0; byte[] b = new byte[1024]; while ((l = br.read(b))!=-1){ bm.write(b); bm.flush(); System.out.println("复制成功"); } br.close(); bm.close(); } catch (Exception e) { e.printStackTrace(); } } }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。