FileInputStream fis = null;
try {
fis = new FileInputStream("F:\\a.txt");
int temp;
String str = "";
while((temp = fis.read()) != -1) {
str += (char)temp;
}
System.out.println(str);
//将数字等正常输出
System.out.println(new String(str.getBytes("ISO8859-1")));
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
fis.close();
fis = null;
} catch (IOException e) {
e.printStackTrace();
}
}a.txt中为汉字,以字节流读入,最后打印为正常汉字,请详细解释下上面注释部分,我想知道原理。谢谢