首页 > 其他 > 详细

开启新的篇章

时间:2015-12-28 06:35:16      阅读:103      评论:0      收藏:0      [点我收藏+]

学习什么?


package com.java.Input15;


import java.io.FileInputStream;

import java.io.FileNotFoundException;

import java.io.FileOutputStream;

import java.io.IOException;


public class FileOutputStreamTest {

//复制一个txt文件内容到另一个中

public static void main(String[] args) throws IOException {

try {

FileInputStream fi = new FileInputStream("File.java");

FileOutputStream fo = new FileOutputStream("newFile.java");

{

byte[] bbuf = new byte[32];

int hasRead =0;

while( (hasRead=fi.read(bbuf))>0 ){

fo.write(bbuf,0,hasRead);

}

}

} catch (FileNotFoundException e) {

e.printStackTrace();

}

}


}


开启新的篇章

原文:http://hckjava.blog.51cto.com/3085410/1728903

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!