import java.io.BufferedReader;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
public class TestFileWriter {
public static void main(String [] args) {
try {
FileReader out = new FileReader("d:/a.txt");
BufferedReader br=new BufferedReader(out);
char a[]=new char[1024];
String line=null;
for(;(line=br.readLine())!=null;){
System.out.print(new String(line.getBytes("UTF-8"))+"\n");//inputStreamReader中有解码器,而Filereader是其子类,没有继承里面的这个方法,所以转码时出错。要么直接用父类进行流的操作。
}
out.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
阅读(2209) | 评论(0) | 转发(0) |