public static void main(String[] args) throws IOException
{
FileInputStream inputStream = new FileInputStream("d://a.txt");
//设置inputStreamReader的构造方法并创建对象设置编码方式为gbk
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream,"gbk"));
String str = null;
while((str = bufferedReader.readLine()) != null)
{
System.out.println(str);
}
//close
inputStream.close();
bufferedReader.close();
}