java034缓冲流的特殊功能复制文本

缓冲流的特殊功能复制文本

package day04;

import java.io.BufferedReader;

import java.io.BufferedWriter;

import java.io.FileReader;

import java.io.FileWriter;

import java.io.IOException;

//void newLine();

//String readLine();

public class SpecialBufferedDemo {

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

//创建输入缓冲流对象

BufferedReader br = new BufferedReader(new FileReader("Ping_Wei.java"));

//创建输出缓冲流对象

BufferedWriter bw = new BufferedWriter(new FileWriter("e.txt"));

//读写数据

String line;

while((line=br.readLine())!=null){

bw.write(line);

bw.newLine();

bw.flush();

}

bw.close();

br.close();

}

}

你可能感兴趣的:(java034缓冲流的特殊功能复制文本)