以reader结尾的都是以字符方式读入,而以stream结尾的都是字节形式
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
public class Main {
public static void main(String[] args) throws IOException {
Scanner sc = new Scanner(new BufferedReader(new InputStreamReader(new FileInputStream("resource/A.in"))));
//BufferedReader只能读入以字符形式装入的流,BufferedReader(Reader in),
//new BufferedReader(new InputStream(new FileInputStream("resource/A.in")))是错误的
while(sc.hasNextLine())
{
String str=sc.nextLine();
System.out.println(str);
}
}
}