package com.code;
import java.io.BufferedInputStream;
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
public class Test3 {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
//例如 对c:/a.txt进行读取
String string;
try {
FileInputStream fileInputStream=new FileInputStream("c://a.txt");
BufferedReader bufferedReader=new BufferedReader(new InputStreamReader(fileInputStream));
string=bufferedReader.readLine();
System.out.println(string);
while (string!=null) {
string=bufferedReader.readLine();
System.out.println(string);
}
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}