package cwj.bbb;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.Reader;
import java.io.Writer;
class StreamTest
{
public static void main(String[] args) throws IOException
{
File file = new File("/home/cwjy1202/hadoop/javaTest/input02.txt");
Reader br = new BufferedReader(new FileReader(file));
Writer bw = new BufferedWriter(new FileWriter("/home/cwjy1202/hadoop/javaTest/input015.txt"));
//逐个读取
int len = br.read();
while(-1 != len)
{
//逐个写入
bw.write(len);
//逐个读取
len = br.read();
}
//刷新缓冲区,将缓冲区的数据强制写到目标文件中
bw.flush();
bw.close();
br.close();
}
}