学习什么?

 

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();

}

}

}