Public void test01 () throws IOException {
FileInputStream fle=new FileInputStream (" d:/GBK file. TXT ");
InputStreamReader isr=new InputStreamReader (fle, "GBK");
BufferedReader br=new BufferedReader (isr);
String line;
While ((line=br. ReadLine ())!=null) {
System. The out. Println (line);
}
br.close();
Isr. The close ();
Fle. Close ();
}
Code above normal output after local variable substitution line for the readline method, it will only output the null, below is the modified code:
Public void test01 () throws IOException {
FileInputStream fle=new FileInputStream (" d:/GBK file. TXT ");
InputStreamReader isr=new InputStreamReader (fle, "GBK");
BufferedReader br=new BufferedReader (isr);
While (br) readLine ()!=null) {
System. The out. Println (br) readLine ());
}
br.close();
Isr. The close ();
Fle. Close ();
}