A股上市公司传智教育(股票代码 003032)旗下技术交流社区北京昌平校区

 找回密码
 加入黑马

QQ登录

只需一步,快速开始

© q8893616 中级黑马   /  2015-5-18 23:35  /  407 人查看  /  1 人回复  /   0 人收藏 转载请遵从CC协议 禁止商业使用本文

import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;

public class Test2 {
        public static void main(String[] args) throws IOException {
                BufferedInputStream a = new BufferedInputStream(new FileInputStream(
                                "D:\\试验场\\a.txt"));
                BufferedOutputStream b = new BufferedOutputStream(new FileOutputStream(
                                "D:\\试验场\\大时代\\lkdguf.txt"));
                byte [] a1 = new byte[1024];
                int a2 = 0 ;
                while((a2 = a.read(a1))!=-1){
                        b.write(a1, 0, a2);
                }
               
               
                FileInputStream c = new FileInputStream("D:\\试验场\\a.txt");
                FileOutputStream d = new FileOutputStream("D:\\试验场\\大时代\\lkdguf.txt");
                byte[] c1 = new byte[1024];
                int c2 = 0;
                while ((c2 = c.read(c1)) != -1) {
                        d.write(c1, 0, c2);
                }
                c.close();
                d.close();
        }
}

1 个回复

倒序浏览
哈哈哈,不错不错
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 加入黑马