package com.power;
import org.junit.Test;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
public class Test1 {
//FireWriter
@Test
public void testFireWriter() {
FileReader fr = null;
try {
File file = new File("C:\\Users\\86152\\Desktop\\垃圾\\Test.txt");//实例化
fr = new FileReader(file);
//read : 返回读入的第一个字符 到末尾时,返回-1.
int date;
while ((date = fr.read()) != -1){
System.out.print((char) date);
}
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
if (fr != null)
fr.close(); //流的关闭操作
} catch (IOException e) {
e.printStackTrace();
}
}
}
}