Java文件读写
// 文件读取
// 方法一
String path = "d:\a.txt";
BufferedReader b= new BufferedReader(new FileReader(path));
String s;
while ((s = b.readLine()) != null) {
System.out.println(s);
}
b.close();
//方法二
// String path = "d:\a.txt";
// BufferedInputStream i = new BufferedInputStream(new FileInputStream(path));
// int s1 = 0;
// byte[] b1= new byte[1024];
// while ((s1=i.read(b1)) != -1) {
// System.out.print(new String(b1,0,s1));;
//
// }
// i.close();